- Home /
How is it possible to have an ambiguous reference between the same things?
I'm programming in Unity's Javascript. I tend to avoid MonoDevelop, but I need to actually use the debugger, and my project which compiles & runs just fine in the editor is choking on a single line.
public var registry:Dictionary.<String, HashSet.<Vector3> > = new Dictionary.<String, HashSet.<Vector3> >();
The error it's throwing out is:
/Users/greay/projs/Random/Assets/Scripts/Tile Mapping/TileController.js(49,49): Error BCE0004: Ambiguous reference 'HashSet': System.Collections.Generic.HashSet., System.Collections.Generic.HashSet.. (BCE0004) (Assembly-UnityScript)
What the hell? For one, how can it be an ambiguous reference between X and X? And why does Unity have absolutely no problem with it, but MonoDevelop does?
Answer by Bernie_ClutchPlay · Apr 24, 2015 at 04:25 PM
I was running into the same issue in MonoDevelop. I ended up deriving from HashSet in a c# script in the plugins directory like this:
public class StringSet : System.Collections.Generic.HashSet<string>{}
and then in my javascript file I was then able to have this without the error:
private var mKeys : StringSet;
Hope this helps!
Thanks, this solution works for me. I had a problem (BCE0004 error) with System.Diagnostics.Process and this helped me.
Wow, 2 1/2 years later and I finally have an answer to this!
(granted, this is just a workaround – the error still doesn't make any sense whatsoever. but it'll do)
Answer by Jerdak · Aug 13, 2012 at 02:59 AM
Using the following in an empty javascript script worked just fine:
import System.Collections.Generic;
public var registry:Dictionary.<String, HashSet.<Vector3> > = new Dictionary.<String, HashSet.<Vector3> >();
Likely problem is something similar to this post.
Hm. Then I'm doing something very wrong / something weird's going on. Because I tried creating a sample project with only one javascript with just this code in it, and I'm still getting the same error. I've attached the sample project to this question.
that post seems to suggest duplicate files as the source of the problem (at least for that guy; I'm familiar with the cause of most "ambiguous reference" problems). I don't think that's what's going on here – there's definitely no duplicate files in this test project.
Well... so your example works just fine for me. Same version of Unity. The only change I made to your code was that I scrapped your library and had Unity rebuild it. Not because I thought it would solve the problem, I just don't trust unknown binaries.
... what could I possibly be doing wrong? this error doesn't make any sense, but nothing I try will make it go away. I tried deleting the Library and Temp folder and reimporting everything in Unity, then resyncing the $$anonymous$$onoDevelop project, but it still throws the error as soon as I open it up in $$anonymous$$onoDevelop & try to build. I've got the stock $$anonymous$$onoDevelop that comes with Unity (2.8.2). Running OS X (10.8)
Your answer
Follow this Question
Related Questions
Does anyone know how to fix this if statment? 2 Answers
Can't Use MonoDevelop 3 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
I can't open boo or js scripts in Monodevelop with a default install? 3 Answers
How do i say, if ball is -5 and scene is "MainGame1", go to scene GameOver1 ??? 1 Answer