I know questions about this error have been asked already, but none of the solutions worked for me.
var currentObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
//...
//change some variables and add some components
//...
var script=currentObject.AddComponent("objectInfo");
I have also tried it with
var script;
script=currentObject.AddComponent("objectInfo");
as per one thread here, and also
var script : objectInfo;
script=currentObject.AddComponent("objectInfo");
objectInfo is the name of a script. I copied this code from a previous part of my code which read:
var currentObject = new GameObject(objectList[game, object] + " " + index);
//...
//change some variables and add some components
//...
var script=currentObject.AddComponent("objectInfo");
That code works perfectly. I also tried the random suggestion about deleting the file and repasting the contents. Can someone explain to me what the error message means, and how to fix it? I know I can use the older code and manually create a unit cube mesh and uvs and normals by writing it out by hand, but it seems like it should work with less effort than that. The bad code is being called in a function called loadDeck() which is being called through a string of other functions beginning at onGUI().