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.

Thanks!

asked Jan 12 in Engine by JestersGhost (41 points)

1 Answer

0 votes
Best answer

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

So again, for future reference:

https://docs.godotengine.org/en/3.1/classes/class_object.html#enum-object-connectflags

CONNECT_PERSIST is the flag you need.

answered Jan 12 by JestersGhost (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.