I have a grid that I am adding a gameobject to in a loop, this is basically a list of items in an inventory. The gameobjects being added contain a UIButton script which calls a onclick function attached to the gameobject. I keep getting the same error whenever I click on any of the items in the grid... at this point onclick no long functions.
MissingReferenceException: The object of type 'UIButton' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
I populate the grid using the following code... inside a loop
GameObject _item = Instantiate(MenuItem) as GameObject;
_item.name = _weap.ItemName;
_item.transform.parent = _gridobject.transform;
// outside loop
gridControl.Reposition();
The load function for the grid is called from the Awake() in a script on the parent object. I tried placing the call in Start() thinking it was trying to establish the grid before all objects have been loaded... I use this technique on other lists without any issues...