Hello.
I have a couple of problems in my application.
I have a not standard List with 36 elements in it.
public class ShopScript : MonoBehaviour{
public void BuyRocket(int num)
{
for (var i = 0; i < Itemses.Count; i++)
{
Itemses[i].ActiveRocket.SetActive(false);
if (num == i)
{
Itemses[i].ActiveRocket.SetActive(true);
Debug.Log(Itemses[i].Price);
}
Debug.Log("items " + Itemses[i]);
}
}
}
[System.Serializable]
public class Items
{
public GameObject Prefabs;
public int Price;
public bool IsBought;
public GameObject ActiveRocket;
}
This script I attached on some Button. When I click on them - my fps drops on <20
public class BuyItemScript : MonoBehaviour
{
public ShopScript ShopScript;
public int RocketIndex;
void Start()
{
var itemScript = GameObject.Find("ShopScript");
ShopScript = itemScript.GetComponent<ShopScript>();
}
public void BuyRocket()
{
ShopScript.BuyRocket(RocketIndex);
}
}