it leader
article thumbnail











싱글턴 패턴으로 생성한 객체를 다시 인스턴스화 하였을 때에


오브젝트가 재생산 되는 것을 방지하기 위한 코드



1
2
3
4
5
6
7
8
9
10
11
12
13
14
        
void Awake(){
 
        if( instance != null)
        {
            Destroy(this.gameObject); // 해당 스크립트를 삭제
            return;
        }
 
        instance = this;
        DontDestroyOnLoad(this);
        Application.targetFrameRate = 60; //최대 프레임수를 60으로 지정
 
}
cs




하단에 Application.targetFrameRate = 60;  이부분은 크게 주제와 관계는 없어 보인다.









싱글턴 패턴 사용법이 궁금하신 분들은 아래 링크 참조











profile

it leader

@dev__pixui

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!