Search Unity

Annoying compiler warning, I don't think is correct

Discussion in 'Scripting' started by sebas77, Feb 6, 2020.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,089
    I got files like this one:

    Code (CSharp):
    1. #if UNITY_5 || UNITY_5_3_OR_NEWER
    2. using Svelto.Tasks.FlowModifiers;
    3. using Svelto.Tasks.Unity.Internal;
    4. using System.Collections;
    5. using System.Collections.Generic;
    6. using Svelto.Tasks.Internal;
    7.  
    8. namespace Svelto.Tasks
    9. {
    10.     namespace Lean.Unity
    11.     {
    12.         public class OnGuiRunner : OnGuiRunner<IEnumerator<TaskContract>>
    13.         {
    14.             public OnGuiRunner(string name) : base(name) {}
    15.             public OnGuiRunner(string name, uint runningOrder) : base(name, runningOrder) {}
    16.         }
    17.  
    18.         public class OnGuiRunner<T> : Svelto.Tasks.Unity.OnGuiRunner<LeanSveltoTask<T>>
    19.             where T : IEnumerator<TaskContract>
    20.         {
    21.             public OnGuiRunner(string name) : base(name) {}
    22.             public OnGuiRunner(string name, uint runningOrder) : base(name, runningOrder) {}
    23.         }
    24.     }
    25.  
    26.     namespace ExtraLean.Unity
    27.     {
    28.         public class OnGuiRunner : OnGuiRunner<IEnumerator>
    29.         {
    30.             public OnGuiRunner(string name) : base(name) {}
    31.             public OnGuiRunner(string name, uint runningOrder) : base(name, runningOrder) {}
    32.         }
    33.  
    34.         public class OnGuiRunner<T> : Svelto.Tasks.Unity.OnGuiRunner<ExtraLeanSveltoTask<T>> where T : IEnumerator
    35.         {
    36.             public OnGuiRunner(string name) : base(name) {}
    37.             public OnGuiRunner(string name, uint runningOrder) : base(name, runningOrder) {}
    38.         }
    39.     }
    40.  
    41.     namespace Unity
    42.     {
    43.         public abstract class OnGuiRunner<T> : OnGuiRunner<T, StandardRunningInfo> where T : ISveltoTask
    44.         {
    45.             protected OnGuiRunner(string name) : base(name, 0, new StandardRunningInfo()) {}
    46.             protected OnGuiRunner(string name, uint runningOrder) : base(name, runningOrder,
    47.                 new StandardRunningInfo()) {}
    48.         }
    49.  
    50.         public abstract class OnGuiRunner<T, TFlowModifier> : BaseRunner<T> where T : ISveltoTask
    51.             where TFlowModifier : IFlowModifier
    52.         {
    53.             protected OnGuiRunner(string name, uint runningOrder, TFlowModifier modifier) : base(name)
    54.             {
    55.                 modifier.runnerName = name;
    56.  
    57.                 _processEnumerator =
    58.                     new SveltoTaskRunner<T>.Process<TFlowModifier>
    59.                         (_newTaskRoutines, _coroutines, _flushingOperation, modifier);
    60.  
    61.                 UnityCoroutineRunner.StartOnGuiCoroutine(_processEnumerator, runningOrder);
    62.             }
    63.         }
    64.     }
    65. }
    66. #endif
    never had problems with them, but since 2019.3 I get this warning:

    Class OnGuiRunner can not exist in multiple namespaces in the same file, even if one is excluded with preprocessor directives. Please move these to separate files if this is the case.
    UnityEditor.Scripting.ScriptCompilers:GetClassAndNamespace(String, String, String&, String&)


    I understand this warning makes sense if the class was a Monobehaviour, but it is not. Thoughts?
     
  2. epare025

    epare025

    Joined:
    Oct 9, 2017
    Posts:
    3
    I've come across the same issue concerning other frameworks. I haven't observed any negative effects. Since this is supposed to target classes that inherit from Monobehaviour or ScriptableObject, I think this may be a Unity bug.
     
unityunity