Answer the question
In order to leave comments, you need to log in
How to get data from list?
I need to get data from list. I have gameobjects saved there, I need to take the last one, how to do it?
private GameObject mob;
private List<GameObject> mobs;
void OnTriggerStay2D(Collider2D collider)
{
if (collider.gameObject.tag == "Zombie")
{
if (mobs == null) return;
this.mob = mobs.Count;// я не знаю как взять, подскажите
target = mob.GetComponent<Transform>();
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, Mathf.Atan2(target.transform.position.y - transform.position.y, target.transform.position.x - transform.position.x) * Mathf.Rad2Deg + 90);
Fire();
}
}
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