• Son Luu

VR System - Create and Access Objects via Scripts in Unity


Today I learned and practiced some VR coding in Unity by experimenting creating and accessing game objects via script. Here are some of the results


Experiment 1: create 10 random spheres




Experiment 2: create random sphere with the visible option to control the number of spheres created by adding a field N to input desired number of spheres to be created.



Below is result if the input is 1000 spheres to be created.





Experiment 3: Adding random colors to the created spheres






Experiment 4: Adding a light source inside every sphere created.




Opened in Unity in Play mode, and click on a random sphere, the inspector will show the color and other components. specific to that object.