How to resolve DemoAsteroids compile error?

Options
gas
gas
Hello, I bought PUN2. I use DemoAsteroids. I added scripts to Spaceship.cs for using Ultimate Joystick assett. Then compile error below displayed. please tell me what should I do? Perhaps namespace blocks.

Assets/Photon/PhotonUnityNetworking/Demos/DemoAsteroids/Scripts/Game/Spaceship.cs(90,24): error CS0103: The name 'UltimateJoystick' does not exist in the current context

Assets/Photon/PhotonUnityNetworking/Demos/DemoAsteroids/Scripts/Game/Spaceship.cs(91,28): error CS0103: The name 'UltimateJoystick' does not exist in the current context

Assets/Photon/PhotonUnityNetworking/Demos/DemoAsteroids/Scripts/Game/Spaceship.cs(96,17): error CS0103: The name 'UltimateButton' does not exist in the current context


script

using System.Collections;

using UnityEngine;

using Photon.Pun.UtilityScripts;
using Hashtable = ExitGames.Client.Photon.Hashtable;


namespace Photon.Pun.Demo.Asteroids
{
    public class Spaceship : MonoBehaviour
    {
        public float RotationSpeed = 90.0f;
        public float MovementSpeed = 2.0f;
        public float MaxSpeed = 0.2f;

        public ParticleSystem Destruction;
        public GameObject EngineTrail;
        public GameObject BulletPrefab;

        private PhotonView photonView;

        private new Rigidbody rigidbody;
        private new Collider collider;
        private new Renderer renderer;

        private float rotation = 0.0f;
        private float acceleration = 0.0f;
        private float shootingTimer = 0.0f;

        private bool controllable = true;
        

        #region UNITY

        public void Awake()
        {
            photonView = GetComponent<PhotonView>();

            rigidbody = GetComponent<Rigidbody>();
            collider = GetComponent<Collider>();
            renderer = GetComponent<Renderer>();
            
            
        }

        public void Start()
        {
            foreach (Renderer r in GetComponentsInChildren<Renderer>())
            {
                r.material.color = AsteroidsGame.GetColor(photonView.Owner.GetPlayerNumber());
            }
        }

        public void Update()
        {
            if (!photonView.IsMine || !controllable)
            {
                return;
            }

            //20191116 own from
            //rotation = Input.GetAxis("Horizontal");
            //acceleration = Input.GetAxis("Vertical");
            rotation = UltimateJoystick..GetHorizontalAxis( "Movement" );
            acceleration = UltimateJoystick.GetVerticalAxis( "Movement" );
            //20191116 own to

            //20191116 own from
            //if (Input.GetButton("Jump") && shootingTimer <= 0.0)
            if (UltimateButton.GetButtonDown( "Attack" ) && shootingTimer <= 0.0)
            //20191116 own to
            {
                shootingTimer = 0.2f;

                photonView.RPC("Fire", RpcTarget.AllViaServer, rigidbody.position, rigidbody.rotation);
            }

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @gas,

    Thank you for choosing Photon!

    Make sure:

    - namespace for UltimateJoystick is added to the "usings" lines on the top
    - the Spaceship script's assembly has access to the assembly where UltimateJoystick is. this may require asmdef config.