For Example
[HideInInspector]
public GameObject abc;
public Gameobject xyz;
public GameObject rst;
It only hide “abc” gameobject but I want to hide all gameobjects under [HideinInspector].
Is there any way to do this ??
Thanks in advance.
For Example
[HideInInspector]
public GameObject abc;
public Gameobject xyz;
public GameObject rst;
It only hide “abc” gameobject but I want to hide all gameobjects under [HideinInspector].
Is there any way to do this ??
Thanks in advance.
There is a way to hide multiple GameObjects. Here is the code:
[HideInInspector]
public GameObject abc, xyz, rst;
The point is to define all variables in one row.
Nope.
‘[HideInInspector]’ just hides the next line until a semicolon is met (not technically, you can actually even hide some decorators and such… but lets keep it simple). However if the next line were to define multiple variables of the same type then it would work fine. You could do something like this…
using UnityEngine;
public class test : MonoBehaviour
{
// This for example, does not hide both "test1" and "test2" because it breaks at the semicolon.
[HideInInspector]
public float test1; public float test2;
public string test3;
// You can define multiple variables in a single line. They must be same type.
// These are all visible in the inspector as separate variables and function normally.
public string myName = "Joe", hisName = "Fred";
// Same thing, but the entire group is hidden.
[HideInInspector]
public float foo = 5f, bar = 3f, toot = 2f, soo = 9f;
}
This works for your provided scenario, just be aware that you can’t define multiple variables of different types this way.