hide in inspector unity code example
Example 1: how ot make a variable public without showing in the inspector
public float notHidden; // Displayed
[HideInInspector] // Hides var below
public float hidden;
Example 2: how to hide and show object in unity script
GameObject cat;
cat.SetActive(false); // false to hide, true to show
Example 3: unity hide in inspector
using UnityEngine;
public class Example : MonoBehaviour
{
// Make the variable p not show up in the inspector
// but be serialized.
[HideInInspector]
int p = 5;
}
Example 4: unity hide in inspector
[HideInInspector]
public float myVar;