Object
Last updated
Last updated
Along with Numeric and Boolean variables, there is an Object type variable in MANU. An object type variable is a variable where any object can be stored. Almost every object in the Scene Tree can have variables.
The Object Variable can be set in the Inspector Panel. To do this, select the object in the Scene Tree and:
Go to the Inspector Panel and click on Variables Tab. After that, the Variables Panel will appear in the upper right corner of the screen.
Click on the plus (“Add variable” button) and you will see a drop-down list with the variables that MANU has.
Select “Object” from the list.
By default, a set Object variable will have the name Var_1 (there can be a subsequent number instead of 1 if you have already set other variables earlier). You can assign any name to your Object variable. To do this, click on the name of the variable (for example, Var_1) and enter the name you need in the input field. The variable name can be any name.
By default, no value is assigned to the Object variable. Therefore, next to the Object variable name you will see the “No object" option. You can leave it as it is. Alternatively, you can choose an object that you will need at the start of the game. Thereby, you will set the initial value for the Object variable.
To assign an object to an Object variable:
Click on “No object". You will see a list of objects that you have in the Scene. You can assign any objects to an Object variable.
Then, just select the object from the list.
Object variables can be easily switched on tracks in the Timeline Panel. In other words, we can change the value of the Object variable on Timeline.
You can animate the Object variables using all parameters. In this case, the object that is currently in it (in this Object variable) will be animated.
The object type variable can contain any object and all parameters can be used to animate these objects (regardless of whether this parameter applies to this object or not).
Sometimes we do not even know which object is in the Object variable, we can still create tracks in the Timeline and change their value.
For example, for a Box and other Primitives, we can use parameters such as Rotation, Position, Materials, Physics, etc. However, we will not be able to animate Light Intensity and Light Color parameters, which relate to Light objects (light sources or lanterns).
Therefore, if you create animations with these parameters (Light Intensity and Light Color), and there is a Box in the Object variable, then the animation simply will not be played. But as soon as there is a Light object in the Object variable, the animation will start.
In your game, you can include imported assets that also use object variables. These variables can be configured for other objects where these assets were used. The object variable allows you to quickly switch the asset to use it (asset) by other objects in your Scene.
For example, let's take an asset like a weapon that was created by another user (not by you). The user who created the asset could configure it for the characters in his scene. Therefore, when you add this asset (weapon) to your scene, the weapon may not work in your game.
But you may switch the Object variable which this weapon is configured to and which is responsible for the weapon’s targets. As a result, you will quickly get a working external asset in your Scene.