🤔

CS0104#

'reference' is an ambiguous reference between 'X identifier' and 'Y identifier'

Namespaces are declared in the using block at the top of a script.

Everything you access inside of that script needs to have either one version of that identifier in a namespace, or must specify which one it refers to.

This error mentions the two conflicting identifiers and their associated namespaces. It can occur when unintentionally including the wrong namespace as suggested by your IDE.

Resolution#

Remove the conflicting namespace#

If you are not intending to use a namespace, remove it.

-using System;
For example, remove the System namespace if it's irrelevant.

or

Specify the namespace#

If both namespaces must be included, specify which namespace the identifier is a part of.

You can specify the namespace when you refer to the identifier:

UnityEngine.Random.Range(min, max);

Or you can specify the type's namespace by using an alias:

using UnityRandom = UnityEngine.Random;
...
UnityRandom.Range(min, max);

Common conflicts:#

Type Namespace Namespace Likely resolution
Vector3 UnityEngine System.Numerics Remove the second namespace.
Vector2 UnityEngine System.Numerics Remove the second namespace.
Debug UnityEngine System.Diagnostics Remove the second namespace.
Random UnityEngine System Specify which Random you need using an alias.
Random UnityEngine Unity.Mathematics Specify which Random you need using an alias.
Color UnityEngine System.Drawing Remove the second namespace.
MinAttribute UnityEngine UnityEngine.PostProcessing Remove the Post Processing folder from your Assets,
and use the post processing package.