- Home /
compile error. does not denote a valid type.
So I am trying to export out a game to windows 8 store. It works fine in android, windows 7 and so forth. There are no errors except when I export to windows store. I THINK the issue my be the order at which the compile of scripts is being done. Looking at the pictures, you can see in the pulgins folder 'vxbuttonbase' and 'vcanalogjoystick' are c# scripts. This is from Virtual controls I bought which allows joysticks and fire buttons on screen. It works fine with my android cell phone and windows laptop touchscreen.
Now look at the 'scripts' folder. It has playership_js and quitpause.js in it. These reference the c# scripts in the plugins folder. The errors says it can not find the VCbuttonbase. /////////////////////////////////////////////////////// #pragma strict /////////////////////////////////////////////////////// //These are the button and the dpad controller for tough input var PButton:VCButtonBase; //pause button var QButton:VCButtonBase; //quit button
So I was wondering, does this sound like the c# scripts are not compiling first for the windows 8 store export? and if so, how do I get them to compile first? I tried moving the scripts around to different folders but still have error.
Hi, can You show #5,#6 of QuitPause and #20,#21 of PlayerShip? Also have You tried to comment those lines?
EDIT: Are trying to access C# code from Javascript? EDIT#2: You can try http://answers.unity3d.com/questions/252865/accessing-a-c-field-from-javascript.html OR You can rewrite ALL Your code to JS (which I always do in such cases) or to C#.
Hope this will help You a little.
@vulgerstal OR you can re-write all your code to C#, like a sane person. ;)
Answer by RandomCharacters · Nov 17, 2014 at 04:34 PM
I found out the problem. The writer of 'virtual controls' here on the unity store helped out a lot. He looked at my project and eventually wrote this:
"So I searched around, and apparently, when building Windows Store Apps only, the compilation order that Unity enforces normally is ignored, hence the compilation order errors. To fix this, go to Player Settings, and change the "Compilation Overrides" option from "Use Net Core" to "Use Net Core Partially".
So the issue was an export setting. Thanks to all who helped out. Maybe in the manual this could be added to this page: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html "
IF this is really the issue, you should file a bugreport in Unity as this certainly shouldn't be necessary. This is a fundamental feature / behaviour of the editor. It should work the same on all platforms. It would be great if you could setup a small project that reproduces this error which you can attach to a bug report.
Answer by AlwaysSunny · Nov 15, 2014 at 02:16 PM
This is what you need to know: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html
"This is what you need to know: http://docs.unity3d.com/412/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html "
Thanks for your reply, but I already read this. The question is that the C# scripts are in the plugins folder should compile first and the others in the scripts folder should compile last. This is what this page says. However, it seems that this is not happening. Look at the pictures and you see the scripts in the folders. It's as if they are not being compiled or something before they are being assessed by the javascript scripts. This seems to give errors.
========================
"You can rewrite ALL Your code to JS (which I always do in such cases) or to C#."
Like most unity folks, I don't know c#. The virtual controls plugin I bought which is in c#. I have talked tot he writer of the plugin and he thinks it's the order in which they are being complied. We don't know so we are asking everyone else.
========================
///////////////////////////////////////////////////////
#pragma strict
///////////////////////////////////////////////////////
//These are the button and the dpad controller for tough input
var PButton:VCButtonBase; //pause button
var QButton:VCButtonBase; //quit button
/////////////////////////////////////////////////////////
These are the button and the dpad controller for touch input
var AButton:VCButtonBase;
var joystick:VCAnalogJoystickBase;
///////////////////////////////////////////////////////
Answer by Bunny83 · Nov 15, 2014 at 05:44 PM
I guess that the C# scripts you use simply doesn't work for windows store builds. Just take a look into the script file. There might be a preprocessor directive which excludes those classes when you build for windows store. It might be enclosed with
#if UNITY_ANDTOID | UNITY_IPHONE
//...
#endif
This will make what's inside that block to be only compiled when targetting android or IOS. This is usually done to prevent the usage of a class on a platform that isn't supported by that class.
Could it be a issue with unity messing up? I give this a try. $$anonymous$$aybe export the project to a package and import it into a new one. However, could it be another unity bug?
@wheretheidivides:
I never had a bug like that and i don't think it's a bug as $$anonymous$$ono and script compiling usually works the same for all platforms. Certain classes which are exclusive for a specific platform are of course not available to others, like the JNI classes for Android.
I never created a windows store build, so i can't tell for sure. $$anonymous$$aybe the classes are declared as private or internal or something like that? From what we can see there should be no problem.
I've searched a bit and found a (maybe outdated) version of those C# scripts. It doesn't look like they contain any platform specific classes / code besides code that's only for the editor.
When you are in $$anonymous$$onoDevelop, do you see the C# first-pass assembly in the references list of the UnityScript project? If the classes don't change, another way is to compile them into an assembly and replace the standalone scripts with the already compiled assembly. However if those scripts are often updated or changed this is not a very convenient workflow.