Improbable Icon

Forums

Unity GDK: TryGetSpatialOSEntityIdForGameObject

unity-gdk

#1

TryGetSpatialOSEntityIdForGameObject does not find the spatial entity.
When doing a Physics.OverlapSphere query I get several collisions with spatialOS entity related prefabs (query from within an UnityGameLogic script and prefabs initiated by the GameObjectCreationHelper)
When trying to get the corresponding entity I get no results.
I have both a UnityGameLogic prefab and a UnityClient prefab associated with the entity. When running the game the Unity Inspector shows both representations with a SpatialOSComponent.

What am I missing?


#4

Hey @robbert122,

Apologies for the delay in getting back to you. I’ve flagged this with the team and we’ll take a look in to this for you.

best,
Nee


#5

Looks like it has to do with the hierarchy of the gameobject. When I move the Box Collider from the sub-node to the main gameobject node it works!
Its strange. The code worked with the Unity SDK version.


#6

Hey @robbert122,

thanks for getting back to me - good to know that this has been fixed and it’s working! Also thanks for sharing the solution, good to know if anyone else also encounters the same issue!

best,
Nee