Version: 2017.3

HideInInspector

class in UnityEngine

切换到手册

描述

使变量不显示在 Inspector 中,但进行序列化。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { [HideInInspector] public int p = 5; }