cs0122, cs0120 계속 두개가 괴롭힙니다..
1857
player.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Managers mg = Managers.instance;
}
// Update is called once per frame
void Update()
{
}
}
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
managers.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Managers : MonoBehaviour
{
static Managers s_Instance; //유일성이 보장된다
public Managers instance { get { Init(); return s_Instance; } } // 유일한 매니저를 갖고온다
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
static void Init()
{
if (s_Instance == null)
{
GameObject go = GameObject.Find("@Managers");
if (go == null)
{
go = new GameObject { name = "@Managers" };
go.AddComponent<Managers>();
}
DontDestroyOnLoad(go);
s_Instance = go.GetComponent<Managers>();
}
}
}
도대체 어디가 문제인지 모르겠습니다 보호 수준가지고 왜 자꾸 오류가나는지
답변 1
공부 방향성
0
195
1
Desktop용 게임 개발에도 도움이 될까요?
0
202
1
진로가 큰 걱정입니다...
0
298
1
신입 게임 클라이언트 포트폴리오 레포 평가 부탁드립니다
0
294
0
개발자 자리와 AI?
0
456
1
파이어 베이스만 사용하는데
0
338
1
강의 예제 파일을 첨부해 주세요!
0
354
0
강의를 들을 때 해당 메서드의 개념이나 어떻게 작동하는지 모르고 따라 칠때가 있습니다.
0
439
0
클라이언트 네트워크 부분 수업 질문
0
340
0
강의에 대해 질문있습니다
0
417
0
객체지향을 어디서 배워야 할까요
0
378
1
메모리 누수에 대해서 질문드립니다.
1
389
3





