Connect signal for VisualScript "Yield Signal" using oneshot mode

Since the first call to a VisualScriptFunctionState invalidates the
state, any further call results in errors.
This commit is contained in:
Matthias Hoelzl 2017-12-01 04:35:44 +01:00
parent d2e05b6e9b
commit c825a58fe0

View file

@ -2289,7 +2289,7 @@ void VisualScriptFunctionState::connect_to_signal(Object *p_obj, const String &p
binds.push_back(p_binds[i]); binds.push_back(p_binds[i]);
} }
binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing binds.push_back(Ref<VisualScriptFunctionState>(this)); //add myself on the back to avoid dying from unreferencing
p_obj->connect(p_signal, this, "_signal_callback", binds); p_obj->connect(p_signal, this, "_signal_callback", binds, CONNECT_ONESHOT);
} }
bool VisualScriptFunctionState::is_valid() const { bool VisualScriptFunctionState::is_valid() const {