[SOLVED] Deactivate/Activate after a delay
Hello everyone,
I have the script which allows me to deactivate an object after a delay.
I would like to have the script which will allow me to activate a text or an object after a delay.
I wanted to modify the script I had but I did not succeed.
someone can help me ?
Here is the script I have which allows me to deactivate an object after a certain delay :
// @input bool version3 = false { "label":"Use delay" }
// @ui {"widget": "group_start", "label": "Settings", "showIf":"version3"}
// @input SceneObject setEnabledTarget {"label": "Target"}
// @input float triggerDelay {"label": "Delay Time"}
// @ui {"widget": "group_end"}
a
debugPrint("Delay time: " + script.triggerDelay);
var delayedEvent = script.createEvent("DelayedCallbackEvent");
delayedEvent.bind(function(eventData)
{
script.setEnabledTarget.enabled = false;
debugPrint("Disabled: " + script.setEnabledTarget);
});
delayedEvent.reset(script.triggerDelay);
function debugPrint(message) {
print("[delay script] " + message);
}
Hi Maxime,
You can activate an object by setting their enabled value to true rather than false. For example:
By the way, in case you haven't tried it, Behavior script should also help you out here:
https://lensstudio.snapchat.com/guides/scripting/helper-scripts/behavior/
Can't wait to see what you come up with!
Thanks,
Jonathan
Hi Jonathan,
Thanks a lot for your help.
I will finally be able to continue my game.
Cheers