고냥저냥 프로그래밍 배우고 있는 학생이고 질문이 하나 있어서 씀.
유니티로 게임 하나 만드는 중에
this_ship = this.gameObject.transform.parent.gameObject;
그냥 이런 부모 오브젝트 찾아주는 코드를 Start 함수에 집어 넣었는데 아예 작동을 안한다.
//테스트로 public으로 선언
public GameObject this_ship;
private PhotonView photonView;
private Transform this_ship_tr;
private Transform this_ship_tr;
// Use this for initialization
void Start () {
if (!photonView.IsMine)
{
this.gameObject.SetActive(false);
}
void Start () {
if (!photonView.IsMine)
{
this.gameObject.SetActive(false);
}
//이 부분이 작동을 안한다
this_ship = this.gameObject.transform.parent.gameObject;
photonView = GetComponentInParent();
this_ship_tr = this_ship.transform;
}
혹시 어디 꼬인게 있을 까해서 Start 함수 전체 다 올려봤음.
혹시나 했더니 역시나 update 함수에 코드를 넣어주니 매우 잘 돌아가고 start 함수에서만 애가 먹통이 된다.
컴파일러가 this_ship = this.gameObject.transform.parent.gameObject; 부분을 안 읽고 그냥 뛰어넘기는 거 같은데 대체 뭔 현상임 이게.
댓글 0