- Home /
Getting a prefab with javascript FindAsset (Solved)
I'm trying to access and replace a prefab in my assets, but it comes up with null. Here's the part of my code trying to find the prefab:
var SavedDialogueParent = EditorUtility.FindAsset("Assets/DialogueSaved/"+this.gameObject.name+".prefab", Transform);
Debug.Log("Assets/DialogueSaved/"+this.gameObject.name+".prefab");
Debug.Log(SavedDialogueParent);
I already have a prefab of said object at the correct path, and yet it comes up with null even though my Debug.Log prints the correct path and I've been able to use it to create prefabs correctly. So the only variable that could be wrong here is the Transform at the end of the FindAsset-line, right? I've tried Object, GameObject, UnityEditor.PrefabType, PrefabType. I just don't understand what could be wrong. I must be missing something really obvious, so... what is it?
(edit: Transform was right, but apparently the "Asset/"-part of the path is not to be included.)
Your answer
Follow this Question
Related Questions
[Urgent]Changing variables of an object AFTER instantiation 2 Answers
Level Editor in Unity as Editor Extension 1 Answer
Instantiate prefabs just before it comes into view 2 Answers
How would I change the value of one prefab's variable via script without changing all of them? 1 Answer
Assign "Colour" to Prefab -1 Answers