#if doesnt nest in visual studio

This is mostly a cosmetic thing but its bothering me

#if UNITY_ANDROID
        if (Application.platform == RuntimePlatform.Android)
        {
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

        }
#endif

#if UNITY_ANDROID and #endif are not automatically lined up (nested) as a normal if statement would.

I assume there is some setting in visual studio that makes #if go maximum to the left, even if its nested in other methods.

Anyone knows how to fix this? thanks

I don’t think it is possible and there is a reason. This is a valid code:

#if UNITY_ANDROID
        private void Test_Android()
        {
            Debug.Log("Android");
#elif UNITY_WINDOWS
        private void Test_Windows()
        {
            Debug.Log("Window");
#elif UNITY_EDITOR
        private void Test_Editor()
        {
            Debug.Log("Editor");
#endif
            // More code
        }

There is no meaning of indentation of preprocessor expressions.

why would this be so bad? :

            #if UNITY_ANDROID
            private void Test_Android()
            {
                Debug.Log("Android");
            #elif UNITY_WINDOWS
            private void Test_Windows()
            {
                Debug.Log("Window");
            #elif UNITY_EDITOR
            private void Test_Editor()
            {
                Debug.Log("Editor");
           #endif
                // More code
            }

i can recreate it with spaces but whenever i copy paste it reformats back to the left, but if its not possible its not possible, thanks for the reply

In my own opinion: you’re mixing runtime code with compiler preprocessor and in reality indentation needs to have meaning. In case of preprocessors, there is no any meaning.

IDK the official stance on it though, you should ask/research Microsoft.