tomazsaraiva / unity-canvas-page-slider

A Scrollable Page Viewer for Unity
https://tomazsaraiva.github.io/unity-canvas-page-slider/
25 stars 2 forks source link

Editor (type) usage in UnityEditor namespace #8

Open jpetays opened 2 months ago

jpetays commented 2 months ago

I suggest that you explicitly use UnityEditor namespace to avoid compilation errors do to ambiguous names. Every reference to Editor could be ambiguous even if placed inside #if UNITY_EDITOR. I think this is related to UNITY version and maybe 2019 series did it different than later ones!?

When I first encountered this I just fixed it without any regards that I could give back something or even contribute a bit.

Anyway to be on the safe side it is better to use public class PageControllerEditor : UnityEditor.Editor instead of public class PageControllerEditor : Editor or put import using UnityEditor;

You can also create an alias for a namespace or a type with a using alias directive. using Editor = UnityEditor.Editor;

tomazsaraiva commented 2 months ago

That's an interesting suggestion. While I haven't had much trouble with ambiguous names, I often forget to place the import inside #if UNITY_EDITOR. I'll try it like you mentioned it.