I am making a prototype for a Mario game and am having difficulty completing a canned animation for a prefab. There is an item box asset that has 3 materials and an "ItemGet" animation. One of these materials has an active emission property that is supposed to turn off during a specific frame of the "ItemGet" animation. These boxes will have an "Active" and "Inactive" state.
- While "Active", the item box just bobs up and down and IF Mario hits the trigger, the "ItemGet" animation plays (and the player gets a unique item). The box then becomes "Inactive".
- While "Inactive", no animations play, the emission effect is gone and the trigger cannot be reactivated.
Challenges:
- finding the correct property to set a keyframe for in the Animations panel.
- Making sure Active versions of the prefab remain Active after any ItemBox becomes Inactive and that all materials don't change when GetItem plays.
Ideas:
- Instead of keying the emission on/off property (assuming that exists and does what I think it does; trouble finding it), swap the materials.
- ( . . . ), swap the mesh.
Can somebody please help me find a viable way to finish this animation that fits this object's intended use-case?
GameObject -> MeshRenderer -> Material -> _EmissionColor
. If your material is authored differently though the path may differ. \$\endgroup\$MaterialReference[i]
property, wherei
is the index of the material you want to change within the renderer's array. \$\endgroup\$