
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
먹이를 발사하고나서 먹이가 파괴되고나니 더이상 먹이를 발사하지를 않습니다 ㅠㅠ
작성한 코드 및 에러 메세지
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class gameManager : MonoBehaviour
{
public GameObject food;
public GameObject player;
void Start()
{
InvokeRepeating("makeFood", 0.0f, 0.2f); //찍어내는 코드
}
void Update()
{
transform.position += new Vector3(0.0f, 0.5f, 0.0f);
if (transform.position.y > 26.0f)
{
Destroy(gameObject);
}
}
void makeFood()
{
float x = player.transform.position.x;
float y = player.transform.position.y + 2.0f;
Instantiate(food, new Vector3(x, y, 0), Quaternion.identity);
}
}

prefabs으로 만들었는데도 안됩니다....
