hey guys,
well ive been having issues with c# arrays.
please bare with me since i am still noob at coding so will appreciate any help you can provide.
using UnityEngine;
using System.Collections;
public class ArrayInfo : MonoBehaviour {
public object Item = new object[] { "Name",0,"Desc" };
and
using UnityEngine;
using System.Collections;
public class Menu : MonoBehaviour {
public string[] itemName;
public float[] itemHP;
public string[] itemDesc;
public void OnGUI () {
GUI.skin = MySkin;
GUI.Label (new Rect (25, 61, 150, 25), itemName[0]);
GUI.Label (new Rect (25, 90, 150, 25), itemHP.ToString()[0]);
GUI.Label (new Rect (25, 122, 150, 25), itemDesc[0]);
ArrayInfo = GameObject.Find("ArrayInfoGO").GetComponent("ArrayInfo") as ArrayInfo;
ArrayInfo.Item[0] = itemName[0];
ArrayInfo.Item[1] = itemHP[0];
ArrayInfo.Item[2] = itemDesc[0];
}
but i am getting compiler errors
Assets/Scripts/Menu.cs(150,54): error CS0021: Cannot apply indexing with [ ] to an expression of type `object’
which is this line:
any suggestion on what am i doing wrong,
it should be a simple thing which i am missing since i may be tired and looking at the wrong place.
anyways, your help will be greatly appreciated.
regards