To do so, you first need to start by creating a new folder and naming it "Resources"
You put whatever you want to load in the script in the folder, textures, prefabs, all that stuff.
So if you want to Instantiate a prefab, you would simply put this in the code.
var boat : GameObject = (Resources.Load("Boat"));
Instantiate(boat, location, rotation);
Simple right?
If you want to get something out of a folder in the resources folder you just say:
var smallBoat : GameObject = (Resources.Load("folder name/Small Boat"));
Ta da. Easy.
Read more at Unity's scripting Reference here
You put whatever you want to load in the script in the folder, textures, prefabs, all that stuff.
So if you want to Instantiate a prefab, you would simply put this in the code.
var boat : GameObject = (Resources.Load("Boat"));
Instantiate(boat, location, rotation);
Simple right?
If you want to get something out of a folder in the resources folder you just say:
var smallBoat : GameObject = (Resources.Load("folder name/Small Boat"));
Ta da. Easy.
Read more at Unity's scripting Reference here
Comments
Post a Comment