- Home /
How to load 3d models into script as one object
I'm trying to load some of my 3d models in my assets with formats such as .FBX or .OBJ into my script; Typically I've used:
string[] guids = AssetDatabase.FindAssets(filter, foldersToSearch);
List<T> a = new List<T>();
foreach (var t in guids)
{
string path = AssetDatabase.GUIDToAssetPath(t);
a.Add(AssetDatabase.LoadAssetAtPath<T>(path));
}
but unfortunately, it loads the entire object like all the children layers materials and every other thing separately; then gives me an array of Object that includes an object with apartment layers.
I want to get each .FBX or .OBJ as one Object or GameObject; I was wondering if there's a solution to my problem.
Comment
Hi, I would check the Editor class: "AssetPostprocessor", it's convenient to check and filter what's imported, or create "clean" prefabs from what is inside FBX.