Hello. I’m trying to port my project from C2 to GD5 and don’t understand how I can initialize state of object instance. In C2, there is a condition On created for this. I was very surprised not to see anything like this
There are 3 ways you can initialise an object’s variable :
-
You can define an object variable with a default value.
-
If you drag and drop the object in the scene, then the variable appears at the bottom of the object properties panel and can be modified (though structures and arrays are a bit trickier)
-
If you create the object instance with an event, you can set the instance variable in the same event, after the create action.
You are right. All of these methods are suitable for setting the value of instance variables and the 3rd method is closest to what I need, but what if I need to create instances not only in an event? I want to create a lot of the same instances during editing, but at run time tweak their properties. Animation, physics, any kind of properties.
Now I have come to the decision to do the following
But to perform the same when creating instances from an event, I will need to duplicate actions or create a function called in each case.
I don’t understand why there are no On created/On destroy events in GDevelop. It would be much more convenient.