Hello. I have a couple of problems in my application. I have a not standard List with 36 elements in it. Code (CSharp): 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 Code (CSharp): 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); } }
This. Remember debug.log is not just putting a string on the console, it's also doing a full stack trace. This gets expensive, especially in loops.