- Home /
Unity Mirror Networkfunctions doesnt work on non-player Objects?
I create a new project in Unity (i did with High definition template) and only include the Mirror asset. Now I am creating a NetworkManager (A) with NetworkManagerHUD. In addition, I create an empty Object (B) with a NetworkIdentity. If I add a script to the Object (B) which calls TargetRpc calls or ClientRpc, then these do not work. I also inherit from NetworkBehavior and include the mirror library. ClientRpc calls do not come and TargetRpc calls only output a NullReference in the Unity Console.
The UnityProject: You can see that the code first checks whether it is the server (in this case it is the server). Then he sends a ClientRpc call to everyone, which should leave a "Test successful" in the console. But this does not happen.
The Test Code:
The Cube Inspector: https://ibb.co/NCQj3Tf
I already tried to spawn the object from the networkManger, but it does not work either. Just on the player Prefab the Rpc-calls work. But it is impossible to write the whole code in the PlayerPrefab.
I ended up spawning everything runtime instead of preplaced them in the Scene. Then it works.
Your answer
Follow this Question
Related Questions
[UNET] Only spawn certain server objects on local client? 0 Answers
Chat system is not working 1 Answer
How do i check which object was instantiated last? 1 Answer
UNET Server List 0 Answers