private void OnCollisionEnter(Collision collision) { if (collision.gameObject.name == "cooker" && transform.gameObject.name != "plate") { Destroy(transform.gameObject); soup = collision.transform.Find("soup"); if (soup) { Vector3 soupScale = soup.localScale; soupScale.y += 0.05f; soup.localScale = soupScale; Debug.Log("soup now rise!"); if (soup.localScale.y >= 0.15f) { Pot pot = collision.gameObject.GetComponent <Pot>(); pot.MakeANewDish(soup); Destroy(soup.gameObject); } } else { soup = GameObject.CreatePrimitive(PrimitiveType.Cylinder).transform; soup.parent = collision.transform; soup.localScale = new Vector3(0.9f, 0.05f, 0.9f); soup.name = "soup"; soup.GetComponent <Renderer>().material.color = new Color(0, 0, 1, 1); soup.localPosition = Vector3.zero; Debug.Log(soup); } } }