Jak usunąć te zacięcia?
skrypt generujący
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class pre : MonoBehaviour {
public Vector3 generat;
public GameObject gen;
public int pool = 0;
List<GameObject> list = new List<GameObject>();
// Use this for initialization
void Start()
{
for(int i = 0; i< pool; i++)
{
GameObject obje = (GameObject)Instantiate(gen);
obje.SetActive(false);
list.Add(obje);
}
InvokeRepeating("k",1.6f, 1.6f);
}
// Update is called once per frame
void Update()
{
}
public void k()
{
for(int i = 0; i < list.Count; i++)
{
if (!list[i].activeInHierarchy)
{
list[i].transform.position = new Vector3(0,gameObject.transform.position.y+25);
list[i].transform.rotation = transform.rotation;
list[i].SetActive(true);
break;
}
}
}
}
Oraz usuwający
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class des : MonoBehaviour {
void OnEnable()
{
Invoke("Destroy", 1.7f);
}
void Destroy()
{
gameObject.SetActive(false);
Destroy(gameObject,1.7f);
}
void OnDisable()
{
CancelInvoke();
}
}