sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

Cameras aren't drawing instantiated objects with cascading render tags

Open CarsonKompon opened this issue 1 year ago • 6 comments
trafficstars

Describe the bug

I have a camera with the following settings: image

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): image

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: image

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 );

image

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 );

image

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

CarsonKompon avatar Feb 21 '24 15:02 CarsonKompon

Did this change recently?

garrynewman avatar Feb 22 '24 06:02 garrynewman

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.

Gmod4phun avatar Feb 22 '24 08:02 Gmod4phun

Did this change recently?

Yes this was a recent change

CarsonKompon avatar Feb 22 '24 13:02 CarsonKompon

I suspect it's basically #4931

Gmod4phun avatar Feb 22 '24 18:02 Gmod4phun

Are you still experiencing this @CarsonKompon - it may have been fixed with #4931

cr4yz avatar Mar 14 '24 23:03 cr4yz

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 :)

CarsonKompon avatar May 17 '24 21:05 CarsonKompon