WebGL-only assemblies (only WebGL platform enabled in asmdef
file) are not referenced in Editor, only in the build. This makes logical sense, but it also means that modern dev comforts, such as intellisense, are not available in source files that are part of this assembly.
This can be worked around by enabling Editor in the asmdef
file. But that feels a little wrong to me.
Is there a better way to have WebGL-only assemblies referenced in Editor without enabling it in the asmdef
file?
i thought if you set your build target it activated those
That’s what I expected too, but it doesn’t appear to be the case.
Activating the Web profile defines UNITY_WEBGL
but doesn’t reference the assembly.
bleh, i can see how that would be annoying
Well, as long as it’s working, why not?
But I’m curious, what would necessitate having a WebGL-only assembly definition? Surely what little is web-specific such as making JS calls could be handled by conditionals in the right place, I mean it would just take a single call something like:
RegisterJsFunctionByName(nameof(TheMethod), TheMethod);
And only inside the register method you’d have an #if WEBGL conditional.
That’s a good point. Maybe I don’t need a separate asmdef
and can just use conditional compilation. Thanks for that.