Improbable Icon


Player prefab script disabled?



Iadded a UnityClient script to the player prefab. However it keeps getting disabled by the system.

The function of the script is to send a command to another entity.

Is there a way to debug why it gets disabled?




Usually it gets disabled if a Require object is null (Reader/Writer/CommandSender/CommandHandler). You can check if that’s the case, just run your game and activate the script in the inspector. If it throws the null exception, check which variable is null and then check if the worker handling your script has appropriate rights.


Tested the behavior of the script this way before. When enabling the UnityClient script on the prefab throws no exception!?
Stripped it down to the blank-starter-project and added a Player prefab with the (UnityClient) script.
Only have a null exception on another script not related to the Player.


In the blank starter project prefabs are not connected to entities by default. Please check in the Unity Inspector if your prefab has a SpatialOSComponent script on runtime. If it doesn’t, you need to add the lines


to your WorkerConnectors (I added them to the HandleWorkerConnectionEstablished function). This enables them to associate the entities with the corresponding prefab in Unity.


Yes, got that from the documentation.
When running the game the Player (UnityClient) appears in the hierarchy.

Double checked if I realy got the command sender.
It appears to be null :frowning:
What could be the reason a script can not get a command sender? I thought every script can get a command sender.


Haha alright! :smile:
Glad it works!


Wow, missed the GameObjectRepresentationHelper.AddSystems(Worker.World); in the Client connector!! :roll_eyes:
Missed that one checking the code multiple times.
Thanks for the support!


Haha alright! :smile:
Glad it works!