- Home /
Mirror Script simplifications ?
Hi Community,
I wrote a script to chance the prefab of a unit in mirror. My Solutions works but seems to be a bit complicated.
I have one script on the button that raises an event. Then I subscribe the method ChangePrefab to this event in OnStartAuthority in my spawner script.
In ChangePrefab I call a command CmdChangePrefab to change the Prefab on the server. Finally in the command CmdChangePrefab i call and Rpc RpcChangePrefab to change the Prefab on all clients after cheking if they have authority.
This seems somehow way to complicated and i am wondering if there is a better solution for this.
I want any client to be able to press his button to change his own units prefab. And the new Prefab should also be visible to the other clients.
Help would be appreciated.
Thank you
Your answer
