I'm working on a existing mobile app. There are some occurrences like this:
private void Example()
{
//some universal code
#if UNITY_EDITOR
return;
#endif
#pragma warning disable CS0162 // Unreachable code detected
//some mobile platform code
#pragma warning restore CS0162 // Unreachable code detected
}
I would have implemented it in the past like this:
private void Example()
{
//some universal code
#if !UNITY_EDITOR
//some mobile platform code
#endif
}
The UNITY_EDITOR version looks very ugly and I'm not able to add universal code at the end of the function. On the other hand it has the advantage to be able to find references to the mobile code when working in the Editor.
Is there anything I'm missing? Is there the possibility to change Visual Studio so it finds references and I have code highlighting in !UNITY_EDITOR code?