My game is played with maximum 4 players. Each can instantiate(spawn) object with authority. They do it through a Command invoke.
So I call Command, and on the server the object is instantiated and spawned with authority.
After that step, I want to have reference to that instantiated object on the GamePlayer object with a new script. I can set it now but only with a ClientRPC call and there must be at least two GameObject parameters.
One is the GamePlayer object that I want to access to it’s script and set this script’s variable, the other parameter is the GameObject reference of newly instantiated/spawned object.
Is there an easier way to do it?
Does it cost too much to send GameObject references with Command and ClientRPC calls. Also
I realized I can’t put Custom C# class parameters in those command and clientrpc functions, and also can’t make those custom monobehaviour variables as SyncVar.
Is what I do bad for optimization? Should I proceed with this method of implementation.