Hi everyone, first I want to tell that my english is not perfect.
So here is my problem : I have a _GM gameobject with a NewtorkManager herited script attached, and for ClientRpc methods I use the automatically generated client gameobject.
I have already done a button in my UI that call a ClientRpc method on the client gameobject to synchronize some variables through all clients, it works.
To access the player gameobject I did a static function that return the instance of the player’s gameobject .
NetworkPlayer is the script attached to players gameobjects.
Buuut when I try to call the
NetworkPlayer.PlayerGameobject.GetComponent<NetworkPlayer>().RpcTellClientPlayerNumber(numberOfPlayer);
I get an error : Object reference not set to an instance of an object.
If I delete the line from the NetworkManager herited script, the client’s gameobject appear in my scene, if I call the gameobject, it will disappear.
There is no lines of code into the “RpcTellClientPlayerNumber(int a)” method …
Idk what to do. Is the static return of the gameobject a problem ? That just make no sense.
Thank you for reading this and eventually for a response.
PS: My NetworkManager herited script & my networkplayer script :
http://image.noelshack.com/fichiers/2016/02/1452692996-aze.png <= The LAST line of code
http://image.noelshack.com/fichiers/2016/02/1452692996-qsd.png
http://image.noelshack.com/fichiers/2016/02/1452693199-wxcv.png
http://image.noelshack.com/fichiers/2016/02/1452693145-wxc.png