K
K
KpacaB4uK2017-08-19 23:47:53
Arrays
KpacaB4uK, 2017-08-19 23:47:53

When all prefabs are removed write +1 how?

prefab in the array, you need to make sure that when you click on it, it is deleted and writes +1 to the variable when all prefabs are deleted.
In principle, it is impossible to delete elements in an Array, how can this be written otherwise through a sheet?
public GameObject[] krugi=new GameObject[10];
private void OnMouseDown()
{
Destroy(krugi[???]); //How to make that when you click on the circle, this particular circle is deleted?
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Griboks, 2017-08-20
@Griboks

Use List<GameObject>. Then everything is simple:
private void OnMouseDown()
{
Mylist.Remove(gameObject);
Destroy(gameObject);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question