sbox-issues
sbox-issues copied to clipboard
Cameras aren't drawing instantiated objects with cascading render tags
Describe the bug
I have a camera with the following settings:
And I have a GameObject I'm treating as a mini-scene that is only drawn by this Camera (and it has the "equipment-scene" tag on the root GameObject as such):
The Avatar and GrugBrow GameObjects already exist in the scene when the game starts, but the "GameObject" Loin Cloth is instantiated in code. You can see here that the Avatar has the cascading tag, and is being drawn in the camera:
But the instantiated GameObject (loin cloth) is not being drawn to the camera, even though it also has the cascading tag (according to the inspector):
var uiObject = equipmentObject.Clone();
uiObject.SetParent( GameHud.Instance.AvatarRenderer.GameObject );
Adding the following to the code (forcing the tag) fixes the issue:
var uiObject = equipmentObject.Clone();
uiObject.Tags.Add( "equipment-scene" );
uiObject.SetParent( GameHud.Instance.AvatarRenderer.GameObject );
To Reproduce
Have a hierarchy similar to my setup and instantiate something similarly to how I am and see the code differences.
Expected behavior
It should render to the camera.
Media/Files
No response
Additional context
No response
Did this change recently?
Not sure if this is related to something I encountered a few days ago, but I think changing the parent does not update tags correctly. They update after the GameObject is disabled and then reenabled.
Did this change recently?
Yes this was a recent change
I suspect it's basically #4931
Are you still experiencing this @CarsonKompon - it may have been fixed with #4931
Are you still experiencing this @CarsonKompon - it may have been fixed with #4931
Not sure how I missed this but I'm definitely still experiencing this issue on a brand new project today. I know that you no longer work on s&box so hopefully I can get someone else from facepunch to investigate this again :)