Resources.LoadAll PrefabsOnly("path");
I see that I can use models = Resources.LoadAll<Texture>("Asteroids");
and it will load all the textures in the folder and their childs folders.
I want to only load the prefabs
, I see I can use UnityEditor.AssetDatabase.GetAllAssetPaths ();
and filter there the suffix .prefab
, but is not correct to use an editor thing inside a game.
Answer by hexagonius · Sep 19, 2015 at 09:18 PM
Doesn't putting all prefabs in one particular folder and
Resources.LoadAll<GameObject>("path")
work? just a guess.
Yes it does, but I can't change the folder structure or contents this time, so loadall should be able to filter prefab from normal models
Could you clarify what the difference is between "prefab" and "normal models" in your project? Once they get included in the game, any editor-usable information about prefab status gets lost. All GameObjects become prefabs. Other types like Texture you can tell apart by type.
Your answer
Follow this Question
Related Questions
Place prefab with mouse on to a grid based surface with a correct orientation. c# 0 Answers
List of unused game objects and prefabs 1 Answer
All instantiated objects having same location, 0 Answers
How to recover missing prefab?,How to recover missing prefabs? 0 Answers
Assign a prefab to gameobjects 2 Answers