Trouble isolating controls for players on network

I’m rather new with networking in general, and for a mobile game I’ve designed multiplayer around the Unity masterserver.
A long time ago, I purchased scripting from someone, he designed the mobile scripting for movement. It works wonderfully and I am happy with the purchase, however I am having issues having the specific player update their own ship.

When I start the game, I connect the 2 players and load the level, when the level loads they are both spawned and looking at their own ship, however when I move the ship for either client it acts really strange and updates both clients for the movement and is not working anywhere near it should be.

I know there is networkView.isMine
but I am unsure how to wrap all the movement scrips into that so only the client updates their shp while moving then updates the server of the position.

Confused? Sorry, I hope I was clear enough.

Are you saying one players movements controls EVERY players movements?

Yes, that is what I am saying.
That is what seems to be happening.

You need to check for .isMine as you stated.

How exactly can I do that? I’m confused by the movement scripts first off because I didn’t write them, they seem pretty complex with a lot of different functions and variables, and it seems to be in 2 separate scripts. I think that’s where I am mostly confused.

A simple if statement wrapped around the contol, check for the networkView.isMine. Hard to be more specific when i dont know the code.

Another way is to disable the script if it is not the players.

Sorry for the long post, but I’ll post the code I have.
I appreciate your help, thank you very much. I only pasted the actual code, the top portion of the scripts just make it longer.

Mobile Input

public override void Init()
    {
        base.Init();
        touchArea = new Vector2(100, 100);
        
        //Setup Sticky GUI Texture
        sticky.pixelInset = new Rect(Screen.width * 0.1f, Screen.height * 0.1f, Screen.width * 0.1f, Screen.width * 0.1f);
        stickyWidth = sticky.pixelInset.width / 2;
        stickyHeight = sticky.pixelInset.height / 2;

        btShot.pixelInset = new Rect((Screen.width - Screen.width * 0.1f) - Screen.width * 0.05f, (Screen.width * 0.1f) - Screen.height * 0.1f, Screen.width * 0.1f, Screen.width * 0.1f);
        btTurbo.pixelInset = new Rect((Screen.width - Screen.width * 0.1f) - Screen.width * 0.02f, (Screen.width * 0.1f) + Screen.height * 0.15f, Screen.width * 0.1f, Screen.width * 0.1f);
	}
    public override void Stop()
    {
        base.Stop();
    }

    // Update is called once per frame
    void Update()
    {
			
        if (accelerometer)
        {
            CheckMovementTilt();
        }
        else
        {
            if (Input.touchCount > 0)
            {
                CheckMovement();
                CheckButtons();
            }
            else
            {
                pitch = Mathf.Lerp(pitch, 0, Time.deltaTime * 5);
                yaw = Mathf.Lerp(yaw, 0, Time.deltaTime * 5);

                ResetSticky();
                ResetShot();               
            }
        }
	}
    private void CheckMovementTilt()
    {
        pitch = Input.acceleration.x;
        yaw = -Input.acceleration.y;

        if (Mathf.Abs(pitch) * 10 < pitchOffset)
        {
            pitch = 0;
        }

        if (Mathf.Abs(yaw) * 10 < yawOffset)
        {
            yaw = 0;
        }
    }

    private void CheckMovement()
    {  
			
        Touch t = Input.GetTouch(0);
        bool moveTouch = false;
        foreach (Touch touch in Input.touches)
        {
            if (touch.position.x < Screen.width / 2)
            {
                t = touch;
                GetInitTouchPosition(t);
                moveTouch = true;
                break;
            }
        }
        if (!moveTouch)
        {
            pitch = Mathf.Lerp(pitch, 0, Time.deltaTime * 5);
            yaw = Mathf.Lerp(yaw, 0, Time.deltaTime * 5);
            ResetSticky();
            return;
        }


        myDelta = initPosition - t.position;
        myDelta.x = Mathf.Clamp(myDelta.x / touchArea.x, -1, 1) * -1;
        myDelta.y = Mathf.Clamp(myDelta.y / touchArea.y, -1, 1) * -1;
                
        pitch = -myDelta.y;
        yaw = myDelta.x;

        Vector2 tPos = new Vector2(initPosition.x + (myDelta.x * touchArea.x) - stickyWidth,
                                     initPosition.y + (myDelta.y * touchArea.y) - stickyHeight);
        
        sticky.pixelInset = new Rect(tPos.x, tPos.y, sticky.pixelInset.width, sticky.pixelInset.height);

        //sticky.enabled = true;        
        sticky.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
	}
    private void GetInitTouchPosition(UnityEngine.Touch touch)
    {
			
        if (touch.phase == TouchPhase.Began)
        {
            initPosition = touch.position;
        }
    }        
    private void CheckButtons()
    {
			
        UnityEngine.Touch t;
        bool isPressingShot =false,isPressingTurbo=false;
        bool rightSideTouch =false;
        foreach (UnityEngine.Touch touch in Input.touches)
        {
            if (touch.position.x > Screen.width / 2)
            {
                t = touch;
                rightSideTouch = true;
                if (btShot.HitTest(t.position))
                {
                    shot = true;
                    isPressingShot = true;
                    btShot.color = new Color(0.5f, 0.5f, 0.5f, 0.5f); ;
                }
                else
                {
                    if (!isPressingShot)
                        ResetShot();
                }
                if (btTurbo.HitTest(t.position)  t.phase == TouchPhase.Began)
                {
                    turbo = !turbo;
                }

                if(turbo)
                {
                    isPressingTurbo = true;
                    btTurbo.color = new Color(0.5f, 0.5f, 0.5f, 0.5f);
                }
                else
                {
                    if (!isPressingTurbo)
                        ResetTurbo();
                }
            }
        }

        if (!rightSideTouch)
        {
            ResetShot();
        }
	}
    private void ResetSticky()
    { 
        //sticky.enabled = false;
        sticky.color = new Color(0.5f, 0.5f, 0.5f, 38f / 255f);
        sticky.pixelInset = new Rect(Screen.width * 0.1f, Screen.height * 0.1f, Screen.width * 0.1f, Screen.width * 0.1f);
	}
    private void ResetShot()
    {
        shot = false;
        btShot.color = new Color(0.5f, 0.5f, 0.5f, 38f / 255f);
	}
    private void ResetTurbo()
    {
        turbo = false;        
        btTurbo.color = new Color(0.5f, 0.5f, 0.5f, 38f / 255f);
    }
}

Also there is “ShipControl”

   void Start()
    {      
        SelectInput();
    }

    // Update is called once per frame
    void Update()
    {
        RotateShipMesh();

        Shot();
    }
    
    // Update is called once per frame
    void FixedUpdate()
    {
        CalculateSpeed();
                
        if(_input.turbo)
            rigidbody.velocity = transform.forward * turboSpeed;
        else
            rigidbody.velocity = transform.forward * speed;

        _inputForce = (Vector3.right * _input.pitch * pitchMultiplier) + (Vector3.up * _input.yaw * yawMultiplier);
        transform.Rotate(_inputForce * Time.deltaTime, Space.Self);
        
        Debug.DrawLine(transform.position, transform.position + _inputForce * 5);
    }

    void CalculateSpeed()
    {
        float x, y, z;
        x = Vector3.Dot(rigidbody.velocity, transform.forward);
        y = Vector3.Dot(rigidbody.velocity, transform.right);
        z = Vector3.Dot(rigidbody.velocity, transform.up);
        currentSpeed = new Vector3(x, y, z).magnitude * 2.237f;
    }

    void RotateShipMesh()
    {
        Vector3 rot = mesh.transform.localEulerAngles;
        rot.y = _input.yaw * 20;
        rot.x = _input.pitch * 20;
        rot.z = 45 - _input.yaw * 15;
        mesh.transform.localEulerAngles = rot;
    }

    void Shot()
    {        
        shotTimer += Time.deltaTime;
        if (_input.shot)
        {
            //Enough time passed to shot next missile?
            if (shotTimer > shotRate)
            {
                GameObject shot = (GameObject)Instantiate(shotPrefab, transform.position, transform.rotation);
                shotTimer = 0;
            }
        }
    }

    void OnCollisionEnter(Collision p_coll)
    {        
    }

    void OnTriggerEnter(Collider p_other)
    {        
    }

    /// <summary>
    /// Select correct input method based on platform
    /// </summary>
    private void SelectInput()
    {
        if (Application.isEditor)
        {
            if(ApplicationManager.Instance.isTestingRemote)
                _input = GetComponentInChildren<MobileInput>();
            else
                _input = GetComponentInChildren<KeyboardInput>();
        }
        else if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            _input = GetComponentInChildren<MobileInput>();
        }
        else
        {
            _input = GetComponentInChildren<KeyboardInput>();
        }

        _input.Init();
    }
}

Just frame everything in the Update method with an if(networkView.isMine) { … }

Wouldn’t that kill performance, especially on mobile?
And when you say “everything” what exactly do you mean?
Sorry, being as I didn’t write this I’m a little confused on what happens with it.

  void Update()

    {

        if(networkView.isMine)    

{

        if (accelerometer)

        {

            CheckMovementTilt();

        }

        else

        {

            if (Input.touchCount > 0)

            {

                CheckMovement();

                CheckButtons();

            }

            else

            {

                pitch = Mathf.Lerp(pitch, 0, Time.deltaTime * 5);

                yaw = Mathf.Lerp(yaw, 0, Time.deltaTime * 5);

 

                ResetSticky();

                ResetShot();               

            }

        }

    }

}

Yeah I feel silly, I should have read more carefully. I missed the word “with.”
Sorry to waste your times guys, I appreciate it and will come back if I have another question.

Not a problem buddy, we all have a herp derp every now and then.

PM me if you need any help.

It is working, however the controls are backwards. For example if i test with my computer and my phone, my phone moves the player on my comp, and my comp moves the player on my phone.
I should also note they use different scripts.
Seems odd to me.

You did add:

if(networkView.isMine)

to the other script as well, right?

Yes.