0 votes

I have a scrollcontainer that is inside a canvas layer which is attached to the player. Per default it is invisible an shall only only show up when a certain button is pressed ( I make it visible with 'that_container'.visible), and hide again, when I chose something from it. I load its options from a json and everything appears just fine, but it does not disappear after the selection. What I tried so far:
1. inside my global singleton:

var cont = get_node(path_to_thecontainer)
cont.visible = false (alternative: cont.hide())

absolutely no effect (path is correct, quadrupel checked it)

2 define a signal inside my global singleton:

signal done_choosing
emit_signal("done_choosing") #after the selection happenend (it does happen, did check this like a million times, so the signal should be emitted just fine)

then (alternative a) in my script attached to the container:

self.connect("done_choosing", self, "make_invisible")

func make_invisible():
self.hide() # or self.visible = false 

no effect... again
alternative b inside the script of my UserInterface

var cont = get_node(path_to_thecontainer)
cont.connect("done_choosing", self, "make_invisible")

func make_invisible():
var cont = get_node(path_to_thecontainer)
    cont.hide() # or cont.visible = false

nada. Well I tried to put a print("Hi") inside the make invisible function, which did not even once appear in the output window. Therefore, I think there is something wrong with my signal approach in general.

So these are all the ways I could possibly think of to get this done. I would appreciate any hints or alternative ways to do this.

in Engine by (55 points)

1 Answer

0 votes

Ok I solved the issue myself. For anyone, who runs into the same issue:
My mistake was to connect the signal to the scrollcontainer instead of connecting it to the autoload script from where the signal is emitted.

by (55 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.