Problem with PUN i need help

Options
Hello i create a 3D games but i need help for instantiation.
The networking function:

SCRIPT:
http://imgur.com/giJ6u7V

But the Mobilesinglestickcontrol, control all the player in game.
I have try the view.ismine but for me it does not work.
http://i.imgur.com/c2FSYGS.png

You have a solution for the players to be correctly instantiated and the joystick works ?
Thank's a lot.

Best Answer

Answers

  • jeanfabre
    Options
    Hi,

    I think you are facing two problems. one is to instantiate players. the other is to control only your player.

    1: can you confirm that you are instanciating players, and that they are all featured and visible in your scene when you are in a room?

    2: if yes, then you need to modify your script that listen to the inputs routine to only work when the ohotonView.isMine

    so where you have in your code: CrossPlatformInput.GetAxis("Horizontal") you need to wrap this around an if statement that only works if isMine is true.

    does that make sense? the wrapper can sit at different level above this code, maybe you have a function that reads input and you would simply not call that function, etc etc.

    Bye,

    Jean
  • I confirm that it instantiates many players correctly, And on the code CrossPlatformInput i would wrap with photonView.isMine but the script does not know the photon library, "Does not exist in the current".
    You have solution ? I have test Photon.MonoBehaviour etc...
    Normally after that, it should work but i need to integrate the photon librairie on the crossplatform script.
  • jeanfabre
    Options
    Hi,

    no, you should not touch the crossPlatformScripts, you should only touch your own scripts where you use CrossPlatformInput.GetAxis("Horizontal"); and for using Photon you need to declare it at the top of your script

    Something like that:

    using System.Collections; using System.Collections.Generic; using UnityEngine; using ExitGames.Client.Photon; using UnityStandardAssets.CrossPlatformInput; public class NewBehaviourScript : Photon.MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (this.photonView.isMine) { float _myInput = CrossPlatformInputManager.GetAxis ("Horizontal"); } } }

    Bye,

    Jean

  • I think i have not understand,

    Joystick Script :
    http://pastebin.com/FdaDycqw

    NetworkController Script:

    http://pastebin.com/JPTvQpVC

    NetworkController with MyInput script:
    http://imgur.com/xnLcVqJ

    Error with MyInput:

    http://imgur.com/AJhgoUB

    I hope it will eventually work.

    Thank's

    Minemega19