Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

the client can't acces to his singleton.

$
0
0
Hello,

I'm currently working on a handball game , and i have some trouble with the network.

when the game start 1 time on 3 my client has some nullReference about some singleton instance. , when for the host it's perfect everytime . I have problem with two of my singleton : The InputManager and the GameManager.

my InputManager is use to reconize the input from the keyboard and is like this :
https://codeshare.io/QyVqO
my GameManager is like this and is use to share between all my player the Ball and the Time (for the moment):
https://codeshare.io/nKSKL
and my singleton Class is like this :
https://codeshare.io/aHYTN
I tried a lot of thing found on internet like :
- going in Edit>Projet Setting > Script Execution Order and put the InputManager at -100 and GameManager at -50 .
- puting in the hierarchie first the inputManager then GameManager and the the other gameObject ( same if I dont think its important here )

I think the probleme is that my singleton or doesnt have the time to instantiate or the script try to acces it when he is not yet create ( but for this las tsolution im not sure because the bug is during all the time of the game so this mean my game never create the singleton )

I try a debug log to see if the gameObject with the singleton was exsiting and he was , my script was alowed to find the script of the singleton but not the instance.

I found one way to correct it but after its usless to use the Singleton Instance and I found this way really Ugly :

- GameObject.Find("InputManager").GetComponent().myFunction()

The first time i had this error it was with my control script for my player in his Update :

float x = InputManager.Instance.GetHorizontalAxis();
float z = InputManager.Instance.GetVerticalAxis();

I think im not managing in a good may the networking and my singleton but i have honestly no idea for the moment :(

Thanks in advance for you help and hopefully i write in a proper english , that you can understand:)
If you need any details or anyhelp to understand my probleme dont hesitate.

ps: no link with my problem but i find really annoying this little popup with the emot following my cursor when i write , and writing a smile everytime i want to go back to the lane :

Viewing all articles
Browse latest Browse all 15755

Trending Articles