- Home /
Unable to access custom editor namespace from runtime assembly
Hi guys
I have a utility class in the editor assembly:
namespace Hydra.HydraCommon.Editor.Utils
{
public static class ScriptableObjectUtils {}
}
And I'm trying to access it via the runtime assembly:
#if UNITY_EDITOR
Hydra.HydraCommon.Editor.Utils.ScriptableObjectUtils.DoSomething();
#endif
However the compiler tells me that the "Editor" namespace does not exist in "HydraCommon".
I know for a fact I can execute editor code in the runtime assembly via something like:
#if UNITY_EDITOR
UnityEditor.Whatever...;
#endif
Why can I not do the same with namespaced classes in the editor assembly?
Thanks, Ves
does the error only present itself when the symbols are in place? no error is thrown when they are removed?
The error remains if I remove the directives.
Adding using UnityEditor;
does not help either, thought it shouldn't be necessary anyway.
Answer by VesuvianPrime · Jun 12, 2015 at 12:46 AM
So I've been doing some reading into how the assemblies are referenced and it seems that what I want to do would create a cyclic dependency.
Essentially, you can access Assembly-CSharp from the Assembly-CSharp-Editor project, but not vice versa.