using System.Collections; using System.Collections.Generic; using UnityEngine; public class Cooking : MonoBehaviour { void GetIngredients() { // foreach (GameObject ingredient in currentCollisions) { // Debug.Log(ingredient.name); // } return currentCollisions } void Update() { GetIngredients(); } // Keep track of ingredients going on and off the cooker. List currentCollisions = new List (); private void OnTriggerEnter2D(Collider2D other) { currentCollisions.Add (other.gameObject); } private void OnTriggerExit2D(Collider2D other) { currentCollisions.Remove (other.gameObject); } }