neuecc / UniRx

Reactive Extensions for Unity
MIT License
7.01k stars 895 forks source link

Warning: The X class can not exist in multiple namespaces in the same file, even if one is excluded with preprocessor directives. #446

Open ATHellboy opened 4 years ago

ATHellboy commented 4 years ago

Hey guys,

I use Unity 2019.2.18. I have these warning after importing the package.

image

egparedessgd commented 4 years ago

Looks like this happens as a warning for files that contain multiple namespaces or classes that inherit from MonoBehavior or ScriptableObject in them.

It seems that this should not apply to the UniRx "operator" classes which inherit from: OperatorObserverBase<TSource, TResult>. I wonder if this is a bug on Unity's end since these classes to do not inherit from MonoBehavior or ScriptableObject.

Do you know if this affects the project?

Some info: https://issuetracker.unity3d.com/issues/cant-add-a-script-as-a-component-when-there-are-two-classes-with-the-same-name-in-the-script-but-in-different-namespaces

eliatlas commented 4 years ago

I have this issue as well. Did someone manage to fix this?

Gaen commented 3 years ago

Some info: https://issuetracker.unity3d.com/issues/cant-add-a-script-as-a-component-when-there-are-two-classes-with-the-same-name-in-the-script-but-in-different-namespaces

Resolved as "by design":

Currently this is by design. Only have one namespace and type in your file, if it inherits from MonoBehavior or ScriptableObject. We have notified our documentation team about missing documentation in this area.