How to do "When I am created" with messages


Sometimes when working with clones, you want to have the same code for when the object is created. And so far, it has usually involved repeating the same code or having an ability twice in “When game starts” and “When object is cloned”.

Having a “When I am created” rule would be most ideal.


But I thought of this way in the meantime, while wanting that rule in a project that I was working on:

You can use the last rule in the picture, for whatever code you want to be run when each object is created.


Rather repeating the same code under “When game starts” and “When object is cloned”, you can connect both rules to trigger another single “When I am created” rule, by using the Broadcast Message block.

Then you can have the code once under the new “When I am created” message rule.

The addition of “Name” and “Clone Index” in the message means that the object is targeting itself. So it will respond to only itself being created, and not to other clones of the same object being created or clones of other objects being created. (You can edit this to suit your project.)


It would be nice to have a rule called “When I am created” (or the way I see it: "When object is created), as it would make projects more code-efficient than before (especially if a lot of clones are used, and all intend to use the same code as the original. It would be most useful (to me) for positioning objects in a perfect grid via set position.

And with scenes, it would be more useful, as everyone won’t have to use “check once if self total clones = 1” to prevent glitches in the objects, or excessive cloning in some cases.

Every time a new block or rule is added, new opportunities open up for potentially better projects.


This would be really useful.


This is definitely an interesting workaround. Thanks for sharing!