VR – Button Appear After Delay

Technology

Unity 3D

Objective

To make a button appear after a set time. This experiment will be utilized in the VR project during the appearance of choices.

Experiment

Before starting the experiment, create a button. Then, add an animation to the button through the animation window. To create the animation, users will need to set a property to the animation. In this case, the scale property will be used. Set the scale on the first second to zero and the last to users’ desired size.

Then, open the button’s Animator window. Create an empty state, rename it to “none”, and set it as default state. This is achievable by right clicking the empty state. This is done so that the button will not trigger the animation previously made upon starting the scene.

Before continuing to the next step, make sure to set the button’s scale to 0 so that the button will be invisible. Next, create a C# code to delay the animation. Below is the code for reference.

Based on the script above, the button’s appearance is delayed by 2 seconds from the start of the scene. Implement the script into the button, and set the Animator as the button’s animator.

Final Outcome

Challenge

The biggest challenge of this experiment is the fact that C# is not taught to students from Raffles Jakarta during their diploma due to difference in curriculum. This is a major setback as now most of the students are encouraged to use Unity to complete their final project.

Conclusion

Overall the experiment was a success although it took quite some time to figure out.

References

https://forum.unity.com/threads/delay-an-animation.434645/

Leave a comment