- Home /
Are any UnityEditor Classes available at runtime (outside of the editor)?
Title pretty much says it all. Though if some are and some are not, I would also be curious where I could find information on the distinction.
I was originally using AssetDatabase.LoadAssetAtPath to find an AnimationClip in a script at runtime, but then I came across a few posts (including this one) saying that this wont work. I looked in the documentation and am not seeing anything about this, which I thought was strange. But then I started thinking, maybe I'm already supposed to know this because none of the UnityEditor classes are available at runtime? If so, I don't remember ever seeing anything about this anywhere.
The function was working just fine when I was testing it, but having seen a few different posts saying it wont work, I'm assuming it was only working because I was testing with the play button in the editor (which also seems strange, but with the given information that is the best guess I can come up with).
Hopefully someone can shed some more light on this for me.
You can refer to UnityEditor classes in any script in the Editor, but then you won't be able to make a standalone build of your project. The closest you get at runtime to AssetDatabase.LoadAssetAtPath is Resources.Load, which assumes the asset in question lives under a "Resources" folder.
Thanks for the tip. I had originally saw that and avoided it because I took its description to mean there had to be a single Resources folder with everything in it (and I just really hated the idea of a file structure like that). Upon closer inspection, I see that isn't the case, so this is a realistic solution for me.
Answer by tswalk · Jul 12, 2014 at 06:10 AM
http://answers.unity3d.com/questions/309300/using-unityeditor-in-runtime.html
nope... the assembly is not included in builds... apparently.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Permanent handles (when object is not selected) 1 Answer
Check if a script is running in editor or game 2 Answers
CustomEditor for 2 List to look like dictionary 1 Answer
Determining which Asset is connected to a GameObject. 3 Answers