티스토리 뷰


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour
{
    public int testNum;
}

Test의 스크립트는 변수 testNum을 가지고있습니다.

 

testNum의 변수는 public이기 때문에 유니티 게임 오브젝트가 Test 스크립트를 가진다면 인스펙터에서 사용자가 변수를 제어할 수 있습니다.

 

하지만 다른 개발자가 해당 변수를 제어하는 걸 원하지 않는다면?

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour
{
    [HideInInspector]
    public int testNum;
}

그렇다면 변수위에 [HideInInspector] 를 붙인다면?

 

더 이상 인스펙터에서 제어할 수가 없습니다.

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour
{
    [HideInInspector]
    public int testNum;
    [HideInInspector]
    public int testNum2;
}

다른 변수또한 감추고 싶다면 역시 변수위에 [HideInInspector] 를 붙여야합니다.


댓글