- Home /
What does BCE0004: Ambiguous reference error mean?
What does BCE0004: Ambiguous reference error mean? I got this error after copy pasting some files in the Assets folder.
Answer by Eric5h5 · Dec 12, 2010 at 04:26 PM
You get that when it's unclear what you're referring to, hence "ambiguous reference." i.e.,
import System;
var foo = Random.value;
In this case, since the System namespace is imported, Unity has no way of knowing whether you mean System.Random or UnityEngine.Random. So you have to make it clear:
import System;
var foo = UnityEngine.Random.value;
Thanks,
I found out that there was a duplicate script (an Assembly script from the data folder for the built standalone version) that I copied into the assets folder.
Answer by Mike 3 · Dec 12, 2010 at 04:25 PM
It means it can't work out which overload of the function to call, generally because you're giving it a variable which doesn't match either overload properly, but can implicitly be casted to both, e.g:
var test : double = 0;
var parsed = parseInt(test);
will throw an ambiguity error, as it can't work out if you're trying to call parseInt(String) or parseInt(float)
Answer by the-Grumbleputty · Mar 11, 2014 at 02:04 PM
I've also had this error turn up when I've used a variable name that was a reserved Javascript keyword, such as "name". A list of reserved words can be seen here: http://www.quackit.com/javascript/javascript_reserved_words.cfm