How to get a reference to all gameobjects in the scene(Unity) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get a reference to all gameobjects in the scene(Unity)

I need to change the material of all gameobjects in the scene by code. I can change the material gameobject by gameobject but thats not practicle

3rd Apr 2017, 3:24 AM
Square Weber Interactive
Square Weber Interactive - avatar
10 Answers
+ 1
you can try Scene scene = SceneManager.GetActiveScene(); GameObject[] rootObjects = scene.GetRootGameObjects(); and if u try it let me know if it works so if it doesnt i will try and suggest other things
3rd Apr 2017, 3:30 AM
Edward
+ 1
not sure. i think this only lets you follow people
3rd Apr 2017, 3:36 AM
Edward
+ 1
tap on the circle next to my name. then press follow at the top right
3rd Apr 2017, 3:37 AM
Edward
+ 1
if you need me just post in this same thread. i followed you so it will notify me when you post here
3rd Apr 2017, 3:40 AM
Edward
+ 1
no idea sorry
5th Apr 2017, 7:27 PM
Edward
0
Awesome, thanks! I will let you know! Can i add you as a friend somehow ??
3rd Apr 2017, 3:35 AM
Square Weber Interactive
Square Weber Interactive - avatar
0
I cannot figure out how to follow
3rd Apr 2017, 3:36 AM
Square Weber Interactive
Square Weber Interactive - avatar
0
That option is not there, thanks tho. I hope I can find you again when i need help.
3rd Apr 2017, 3:38 AM
Square Weber Interactive
Square Weber Interactive - avatar
0
Awesome. Thanks so much
3rd Apr 2017, 3:40 AM
Square Weber Interactive
Square Weber Interactive - avatar
0
How to hold finger on screen and move left and right to move the gameobject? (Similar to rolling sky) i have swipe controls but cannot figure out holding and moving
5th Apr 2017, 2:24 PM
Square Weber Interactive
Square Weber Interactive - avatar