BCE0005: Unknown identifier: 'Cardboard'.
Hi, When I use
if(Cardboard.SDK.CardboardTriggered){ some code }
in Javascript I get error Unknown identifier: 'Cardboard'.
My Cardboard SDK is added as an asset in Unity.
Does this only work in C# or am I missing an import in the Javascript code?
You probably need to 'import' the namespace for the cardboard sdk
Thanks for your quick response Landern.
I've tried to add "import Cardboard;" right under #pragma strict but then it gives me
BCE0021: Namespace 'Cardboard' not found, maybe you forgot to add an assembly reference?
Answer by dolims · Feb 11, 2016 at 04:02 AM
The problem is that Javascript is compiled before C#. This page has the details:
http://docs.unity3d.com/Manual/ScriptCompileOrderFolders.html
"A common example is where a UnityScript file needs to reference a class defined in a C# file. You can achieve this by placing the C# file inside a Plugins folder and the UnityScript file in a non-special folder. If you don’t do this, you will get an error saying the C# class cannot be found."
Your answer
Follow this Question
Related Questions
Can you help me with ''yield WaitForSeconds''? 1 Answer
Dialogue Problem 0 Answers
Check for collision while animating 0 Answers
Find and turn off previous camera? 1 Answer