Initializing parent

Kissen

Member
Joined
Jun 20, 2019
Messages
13
Programming Experience
Beginner
When I initialize multiple objects the inspector easily gets cluttered and hard to read. How can I make then appear as children of an empty gameobject?
 
Your inspector should not be cluttered, this would mean you are adding all your eggs into one basket which is not only unnecessary, but it is also incorrect usage of Unitys game object hierarchy. The purpose of the game objects is to allow you to store other objects inside of them. Simply, you are cluttering your own inspector by adding your scripts to one of your base objects for your scenes hierarchy. Don't do that.

581


Instead, create a new game object by right clicking your game scene and add a new empty object by clicking Create Empty from your right click menu. Then click that game object, rename and call it scripts, and then drag your scripts one by one to the new scripts object inspector on the right side.

582


This allows you to keep the scripts for only that scene inside that game object and you can refer back to said object through code. Note, had I added some public properties etc, they would also appear here in the behaviour scripts sub properties. Since I didn't add any, there are none visible here.

As an aside, this is how you should be wiring up your script from your Management object on your other topic.

If you have any questions, let me know, and I'll try help steer you as I've being using Unity since its release and while I am tight on time, If time is on my side, I will pop back in to answer any questions you got.

Hope that made sense to you?
 
Back
Top Bottom