I’m slowly grasping all of these new concepts and need some advice. My goal is to create a system inside of the DOTS sample project that spawns in a ghost in response to a spawn request. Currently I place down a prefab in the scene which creates a spawn request during conversion. A component system spawns the correct ghost at the required position.
What actually happens is that the ghost is created but only renders at world origin. On the server side the physics components are active and the prefab’s translation shows the desired position.
I’ve regenerated the collection code / snapshot code and the ghost prefab itself has all of the correct settings. Not sure where to go or what to look for from here. Is there anything wrong with my script?
Update: might be a renderer issue. The manual says that an incorrect material or shader setup could make your mesh render at 0,0,0 and no logs or errors would appear. Modifying my shader graphs hasn’t fixed the issue. Currently double-checking everything.
Created materials only using the provided shader graphs
Still unable to solve this issue. The entity itself is interacting in the physics simulation but for some reason won’t render anywhere else. Entity Debugger shows everything is fine. Any help would be greatly appreciated.
If you use the entity manager to inspect the spawned ghost on both the server and the client, do they both have a non-zero translation component? Also, how does your Ghost prefab look like in the inspector, specifically the Ghost Authoring Component section?
On the server world the entity’s Translation, Rotation and LocalToWorld are all non-zero. The entity interacts with the physics environment as expected but nothing is being updated on the client aside from “GameEntityState”.
That’s true. I’ve since fixed the typo with no change in outcome.
I’ve updated my previous post to reflect the fact that Translation, Rotation, and LocalToWorld are not being updated in the client world.
Update: On the Ghost prefab I set a manual field under “Translation” with the name of “Value” and the ghost now spawns at the correct position. Rotation and LocalToWorld are still not being updated.
Ah, I see now. In your Ghost Authoring Component you’re not telling it to sync Translation or Rotation, you can see this by it’s not being bolded like your GameEntityState. It should by default, but not sure if you’re using some example code that disables this by default, or have removed it yourself.
Thank you so much for your help. The solution was setting manual fields to the values in your screenshot on both Translation and Rotation. For some reason I can’t set the field on LocalToWorld, but it doesn’t seem to matter. The server can now spawn entities that are properly replicated to clients.
For reference I’m using NetCode 1-0.0.2 and Entities 17-0.5.0.