Hi, what if I have a folder with many prefabs, too many to pass to the script by hand in the editor. Is there a way in which I could call them from within the script? (instead of dragging them one by one on the script in the editor)
right now, this is that I do
var monkeyPrefab : GameObject;
var lettucePrefab : GameObject;
var shoePrefab : GameObject;
//and so on....
and then I click drag the prefabs from the project onto the script, one by one
but, what I’d like to do is something like this
var myPrefabs : GameObject[];
Function Start(){
myPrefabs = [B]GetPrefabsFromFolders("AllModels/Prefabs/");[/B]
}
GetPrefabFromFolder would be the function I’d need to do what I want, is there a real method to do this?
For quite some time I’ve been wondering this.So far the only way to communicate with my prefabs was using the editor.
With scripting…I can access every object in the SCENE, but if I want to access stuff in the PROJECT files, click and drag with the editor is the only way I know.
While it’s nice to be able to click and drag stuff on the code, sometimes it’d really help me to be able to do it with code.
For example, not long ago I was making a vertex based animation system, each frame was a mesh, but I found no way to access the frames from within the code, I had to drag frame by frame, and each animation was 30 frames, I had no choice but to put that project on hold until I found a way to do this!