Im using this code example from the unity script reference but as is there is a error and I can’t tell why I get this error
Unity - Scripting API: GameObject.FindGameObjectsWithTag // C# version
foreach statement cannot operate on variables of type ‘UnityEngine.Object’ because ‘UnityEngine.Object’ does not contain a public definition for ‘GetEnumerator’
my code:
using UnityEngine;
using System.Collections;
public class Inventory : MonoBehaviour {
public GameObject invslot;
public Object invslots;
void Awake()
{
itm = GameObject.Find("FPSPlayer").GetComponent<Item>();
uss = GetComponent<UISlicedSprite>();
//AddStuff();
}
public void CheckPanelChildren()
{
if (invslots == null)
GameObject.FindGameObjectsWithTag("Invslot");
foreach (Object c in invslots) // error right here
{
}
}
}