
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
3-4 강의 11:50~ 내용입니다.
앞에서는 this.gameObject로 작성하도록 배웠는데, 이번 강의에서는 왜 this를 안 붙였는데도 작동하는 건가요?
작성한 코드 및 에러 메세지
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Food : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
transform.position += Vector3.up * 0.5f; //Vecotr3.up: y값에만 값이 더해지는 unity 엔진
if(transform.position.y>27.0f){
Destroy(gameObject);
}
}
}
