I cant get this to work right for some reason. I have tried Resources and AssetDatabase to run this from but keep getting a null object from it. This is in editor and not runtime. importPath shows up correctly but impObject returns a null object. Any ideas?

var prefabPath : String = assetPath.Replace(".fbx", "Prefab.prefab");
var importPath : String = assetPath;
var impObject : GameObject = Resources.LoadAssetAtPath(importPath, GameObject) as GameObject;

Usage of LoadAssetAtPath is normally discouraged for most purposes. Instead create a folder named “Resources” and place any prefabs you need to load during runtime there and use


see http://docs.unity3d.com/Documentation/Manual/LoadingResourcesatRuntime.html