Answer the question
In order to leave comments, you need to log in
Why doesn't the object spawn?
Hello, help me understand why the _fractions object is not created.
using UnityEngine;
public class PurpleEnemy : Enemy
{
[SerializeField] private GameObject _fractions;
private float _distantion;
private void Update()
{
_distantion = Vector2.Distance(transform.position, _target.transform.position);
if (_distantion <= _distantionForAtack)
{
Burst();
}
}
private void Burst()
{
Destroy(gameObject);
}
private void OnDestroy()
{
Instantiate(_fractions, transform);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question