Destroying assets is not permitted to avoid data loss.
If you really want to remove an asset use DestroyImmediate
이 오류가 떠서 찾아봤더니 프리팹을 삭제하지 말고 복제본을 삭제하라고뜸..(에너미 프리팹을 만듦)
에너미 스포너에서 Instantitate 써서 프리팹 복제본(에너미 프리팹으로) 만들었는데 이걸 에너미 프리팹 안에 있는 에너미 스크립트에서
Destroy(gameObject); 로 삭제할려니까 저래뜬다.. 유튜브도 찾아봤는데 똑같이해도 나는 저 오류가 계속뜨네 ㅠㅠ 해결법좀..
이게 스포너
private bool spawndelay = false;
[SerializeField]
private GameObject go2; // 이게 에너미 프리팹 복제본
// Start is called before the first frame update
void Start()
{
//go2 = GameObject.Find("Enemy");
}
// Update is called once per frame
void Update()
{
Spwn();
}
private void Spwn()
{
if (spawndelay == false)
{
Instantiate(go2, new Vector3((Random.Range(-45, 45)), 3.3f, 45), Quaternion.identity);
Instantiate(go2, new Vector3((Random.Range(-45, 45)), 3.3f, -45), Quaternion.identity);
Instantiate(go2, new Vector3(45, 3.3f, Random.Range(-45, 45)), Quaternion.identity);
Instantiate(go2, new Vector3(-45, 3.3f, Random.Range(-45, 45)), Quaternion.identity);
spawndelay = true;
StartCoroutine(SpwnDelay());
}
}
IEnumerator SpwnDelay()
{
yield return new WaitForSeconds(5.0f);
spawndelay = false;
}
}
글고 에너미 프리팹 안에있는 에너미 스크립트에 이 코드가 있슴
public void Died(float damage)
{
enemyhp -= damage;
if (enemyhp <= 0)
{
Debug.Log("hp 0");
Destroy(gameObject);
}
}
댓글 영역
획득법
① NFT 발행
작성한 게시물을 NFT로 발행하면 일주일 동안 사용할 수 있습니다. (최초 1회)
② NFT 구매
다른 이용자의 NFT를 구매하면 한 달 동안 사용할 수 있습니다. (구매 시마다 갱신)
사용법
디시콘에서지갑연결시 바로 사용 가능합니다.