Question by
$$anonymous$$ · Aug 03, 2017 at 09:34 AM ·
androidiosmonodevelopplatform-supportregion
Rename code inside platform dependent compilation region
In Monodevelop when renaming methods in platform dependent regions regions that aren't active doesn't change. In the example below, if I change the name on PrintAndroidOrEditor();
to for example DebugLogAndroidOrEditor();
only the name of the function and the call in the UNITY_ANDROID
section will be changed - but not the code inside the UNITY_EDITOR
section. Se example below:
Before:
void Start ()
{
#if UNITY_IOS
PrintIOS();
#elif UNITY_ANDROID
PrintAndroidOrEditor();
#elif UNITY_EDITOR
PrintAndroidOrEditor();
#endif
}
void PrintAndroidOrEditor()
{
Debug.Log("On android or editor");
}
void PrintIOS()
{
Debug.Log("On iOS");
}
After:
void Start ()
{
#if UNITY_IOS
PrintIOS();
#elif UNITY_ANDROID
DebugLogAndroidOrEditor();
#elif UNITY_EDITOR
PrintAndroidOrEditor(); // This line was not changed
#endif
}
void DebugLogAndroidOrEditor()
{
Debug.Log("On android or editor");
}
void PrintIOS()
{
Debug.Log("On iOS");
}
Wanted result:
void Start ()
{
#if UNITY_IOS
PrintIOS();
#elif UNITY_ANDROID
DebugLogAndroidOrEditor();
#elif UNITY_EDITOR
DebugLogAndroidOrEditor(); // This line changes as well
#endif
}
void DebugLogAndroidOrEditor()
{
Debug.Log("On android or editor");
}
void PrintIOS()
{
Debug.Log("On iOS");
}
Thanks!
Comment