Hello,
I stumbled upon a very weird bug today. My setup gameobject setup is the following:
A prefab, which has a nested prefab, which has 3 nested prefabs.
Setup
Head, Left Hand and Right Hand all have a component called CopyTransform (a custom component). Whenever the VR Avatar (Remote) is instantiated, that component is enabled in certain cases and disabled in others. In my current tests, I’ve forced it to be enabled (copyComponent.enabled = true). What happens is that it is enabled on the Head but not on Left Hand and Right hand. They share the same code. Debugging results show that they reach the same place in code with the same values. And there are no other places where this component is toggled on or off. I got really frustrated because I did not understand what was going on.
Then I did a debug.log with (transform.root.name). In the case of the Head object, the root is VR Avatar (Remote), as it should be. In case of hands, the root is either Left Hand or Right Hand. It’s as if the nested prefabs do not understand that they are parented under VR Avatar, which is parented under VR Avatar (Remote). If I check the hierarchy in the scene view, they seem to be correct. But for some reason, the root object is different for these 3 objects even though they should not be.
I am using Unity 2019.1.11f1 along with Mirror networking.
Any help would be much appreciated.
Thanks!