When using the width and height of an object inside the “onCreated” function - it’s values are the initial values of the object in the visual editor. Not the values given to the object, when actually used on a scene.
For example:
When the object boundaries are set to 100x100px inside the custom object visual editor
and
The custom object is used elsewhere on a scene and is resized there to say 200x300px
The values obtained by Object.Width()
and Object.Height()
in the “onCreated” lifecycle method of the custom object are 100 and 100 respectively.
Now, the question is:
Is there a workaround for this - to get the dimensions of the object on scene?
Note: I need to use the “expand inner area with parent” feature, to use the extra space afterwards in the object’s actions and conditions, so disabling this option and stretching/scaling the object is not the way things are designed to work.
I would also like to keep be able to somehow reference these values in the “onCreated” function, but perhaps somebody has a different idea.