Godot Engine

Godot Engine

なかの31 Oct 20, 2024 @ 7:32pm
Hiding a Sub Viewport Container.
Just how do I hide or disable a Sub Viewport Container?
Due to how my game works, all npcs have one because they have their own hand sprites, but isn't supposed to show the hands of all other npcs, just only my character hands.

Setting it to not be visible seems to do nothing, and setting processing to disabled does nothing :X.

And yeah, I worry bad stuff might happen with the game project if that's left as is (even more if multiple npcs are involved).
Last edited by なかの31; Oct 20, 2024 @ 7:33pm
< >
Showing 1-7 of 7 comments
Romløk Oct 21, 2024 @ 2:12am 
Sub-viewports can be a bit finnicky IME, but disabling visibility on a SubViewportContainer should work - I've done just that in several of my projects.

Could some code someone be making them visible again in your game? Or does the visibility toggle not even do anything in the editor?
なかの31 Oct 21, 2024 @ 11:00am 
That could be the case. Even more since the codes are old, I might have done something wrong regarding that.
なかの31 Oct 21, 2024 @ 11:25am 
Ok, I think I see the problem.
It's like as if the sub viewport container is global, so if I enable one of the type, enable all of them.
If I disable one, disable all of them. Which is weird.

Edit: Yep, it's exactly what is happening. If I hide the hand sprites from the npcs on the other invisible viewports, only my character hands will be showing up.
And that happens with the sub viewport container of the npcs hidden.
Last edited by なかの31; Oct 21, 2024 @ 11:35am
なかの31 Oct 22, 2024 @ 1:20pm 
That video was extremely handy, and allowed me to know about that particularity of resources (really smart what the devs did btw).
I don't think it's of any help with my issue, since the problem seems unrelated to resources.

I mean, in parts, because the subviewports objects are sharing the same objects with the main camera.

Lemme see if I make a video of the issue in action...
なかの31 Oct 22, 2024 @ 1:28pm 
This shows the issue:
https://youtu.be/zBNOACtOnzE

Only by hiding the hands on the other viewports, my character hands are the only visible.

They initially are hidden, because one of the npcs in the map are spawed after the player character, so the hands ends up being hidden too until I show them.
Last edited by なかの31; Oct 22, 2024 @ 1:28pm
なかの31 Nov 5, 2024 @ 10:39am 
I kinda managed to fix that issue by changing the codes and hide the first person sprites from other npcs when updating the animations.
Still pretty weird that hidden viewports still are visible tho. I hope no performance issues will happen with multiple npcs in same scene :X.
< >
Showing 1-7 of 7 comments
Per page: 1530 50