- 모노디벨롭을 상속받는 클래스의경우
public class GeneralWindow : MonoBehaviour {
#region 인스턴스
private static GeneralWindow _instance;
public static GeneralWindow In {
get {
return _instance;
}
}
#endregion
#region 유니티메서드
void Awake() {
_instance = this;
}
void Start() {
}
#endregion
- 상속받지않는 일반 클래스의경우
public class GeneralDataFile{
#region 인스턴스
private static GeneralDataFile _instance = new
GeneralDataFile();
public static GeneralDataFile In {
get {
return _instance;
}
}
#endregion
그냥 에디터에서
Static 체크하면 instance로 접근가능
'Unity3D' 카테고리의 다른 글
NGUI sprite 텍스쳐 변경 (0) | 2015.05.14 |
---|---|
외부 script 접근 방법 (0) | 2015.05.14 |
NGUI sprite 마우스 입력 (0) | 2015.05.13 |
Error building Player: Win32Exception: ApplicationName='~ 안드로이드 빌드 오류 해결방법 (0) | 2015.05.13 |
sprite 텍스쳐 변경 (0) | 2015.05.05 |