Quantcast
Channel: Questions in topic: "loadassetatpath"
Viewing all articles
Browse latest Browse all 62

LoadAssetAtPath() returning null IN EDITOR

$
0
0
Hello, I've searched and searched and mostly find people trying to use it for runtime stuff with builds and getting null. Well, I'm getting null from within the editor. **No play mode involved**. I have a static class which is used by a custom EditorWindow class. Everything in my editor works fine as far as saving, editing, etc. Except for loading in a prefab. I have tried AssetDatabase and Resources. And both the typed and untyped versions of the Resources function. I also tried LoadMainAssetAtPath(). Have tried both with and without the .prefab extension. Have tried the full path, even the path without "Assets". Everything returns null. I'm actually using the OpenFilePanel to get the path but have hardcoded it to be sure the path is indeed correct and for a better example. I've tried every suggestion and everything I can think of and am hoping someone can tell me what's up. The one thing I haven't tried, and I'm sure would work. Is a Resources folder and Resources.Load(). But I don't want or need these prefabs loaded or bundled at run time so LoadAssetAtPath() seems like exactly what I need but I can't make it work. Unity Consoles 4.3.4f1 GameObject temp1 = Resources.LoadAssetAtPath("Assets/[DragonBuilder]/NewDragon.prefab"); GameObject temp2 = (GameObject)Resources.LoadAssetAtPath("Assets/[DragonBuilder]/NewDragon.prefab", typeof(GameObject)); GameObject temp3 = (GameObject)AssetDatabase.LoadMainAssetAtPath("Assets/[DragonBuilder]/NewDragon.prefab"); Debug.Log(temp1); Debug.Log(temp2); Debug.Log(temp3); http://docs.unity3d.com/ScriptReference/Resources.LoadAssetAtPath.html http://docs.unity3d.com/ScriptReference/AssetDatabase.LoadAssetAtPath.html Thanks!

Viewing all articles
Browse latest Browse all 62

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>