0 votes

I'm trying to create a level-builder for my game.

One of the obvious features is an enemy spawn point. However, spawns can be triggered by several different things - instantly, on a timer, when a player enters an Area2D, etc.

So the level-builder needs to be able to dynamically create the signal connection between the spawn point and whatever triggers it. However, these connections don't seem to be saved to the scene when saved (whereas the Godot editor-set connection for the player spawn does).

Is there anything I can do about this? From what I can find in the documentation, it seems to assume if you're making a connection dynamically then you know how to make the connection and wouldn't need to save it, which I can understand, but isn't always true.

And yes, I can get round this by saving the connection details in exported variables myself and using those to recreate the connection on level load, but that just seems a pain when there already is the facility to save and load signal connections.


in Engine by (41 points)

1 Answer

0 votes
Best answer

...and I find the answer again just after I ask :/ Sorry!

So again, for future reference:


CONNECT_PERSIST is the flag you need.

by (41 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.