Hi,
I was woundering if it is possible to do:
ScriptName temp = Instantiate(Resources.Load("MyPrefab")) as ScriptName;
MyPrefab has a a ScriptName script attached to it. If it is possible I'll change my code, but it's a lot I'll have to change, so I want to be sure before doing it :P
Edit:
I now have the following:
BasicTyle newTile = Instantiate(tile) as BasicTyle;
("tile" is an Object I load elsewhere using Resources.Load(...)) When I do this, it says:
Object reference not set to an instance of an object
Edit 2:
I fixed the problem, using this:
GameObject newTileGO = Instantiate(tile) as GameObject;
BasicTyle newTile = newTileGO.GetComponent("BasicTyle") as BasicTyle;
Thanks !
-The Oddler
Ok, so I guess this is a yes :P :D I read that scriptreference thingy, yet didn't fully understand. After reading a few more times I now understand :D Thanks
– The-Oddlerhmm, doesn't seem to work, I updated my main post with more info.
– The-Oddler