Check when an object instance has been created

I need code to run when an object has just been created, and I see no condition for it. Is a way to do this known?

What do you mean by created? When a scene is generated, or with the action to create instance of an object?

you can either add an object variable set default to 0 and then adjust the object variable is 0 and adjust it to 1
or you can simply create an extension (prefered if it was simple calling parameters)

make a behavior

add On Created events in the functions tab

If you want any action to be executed after an object appears so you need a condition “Current layer”. It checks if an object exists on a layer. If you want to check later how long this object exists already so Start a timer after the “object is on layer” condition. Like this

Note that this has a catch: This function is currently called before the object is properly initialized, so you cannot read most properties (position, angle, etc) from it, nor write them (they will be overridden immediately by the default values as initialisation carries out).

This won’t work. This condition will just be true, unless your object is an another layer, in which case it’ll always be false. It doesn’t allow differenciating in any way created instances from ones that have always been here. If you are suggesting using a default layer and switching it to another one in this same initialisation event, or using the existemce of a timer to check if it has been created recently, that is just a very inefficient and roundabout way to do a boolean flag, and you are better off just using a boolean variable.

Personally, I use the method of checking if the object miss an “Initialized” variable, do what I want to do on creation fro these objects, and set the Initialized variable to true.

with the new update, you can simply wait 0 sec (with probably gets translated into waiting 1 frame) and then collect the info and it works very well

debugger for stored data:

thanks for noting : D

Ooo very smart! This is a pretty good solution, although that does mean rendering a frame with the object incorrectly initialized…

the object can be hidden and then shown
but with delay
but I think your way will be better.

You can add a variable for the object, and put in the code “For each object repeat” and then put in the action “add +1 to (Variable), now if you want to make someting happen when there this object in the scene, you can put " If (Variable) is greater or equal to 1 happen”.

The only error of this code is that if the object is deleted the number still, so when you want to delete the object you need to subtract the variable (-1) in the same event.