UniRx icon indicating copy to clipboard operation
UniRx copied to clipboard

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

Open ATHellboy opened this issue 4 years ago • 3 comments

Hey guys,

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

image

ATHellboy avatar Jan 21 '20 13:01 ATHellboy

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

egparedessgd avatar Feb 14 '20 17:02 egparedessgd

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

eliatlas avatar May 27 '20 13:05 eliatlas

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.

Gaen avatar Dec 22 '20 16:12 Gaen