Hi i’ve been playing with the unity 3.5 developers preview trying to convert some projects i’ve been makeing over to flash and just generaly get a feel for it.
I’ve notised that 3.5 doesn’t seem to deal with standard assets correctly im not entirely sure whats going wrong but in every project i’ve tried to compile i get problems with scripts in standard assets.
You can replicate the issue by trying to compile the explosion framework test level to flash in a blank project.
problem seems to be that it doesn’t recognize some of the classes that are defined in Standard assets in this case the “Detonator” class
At a guess it seems that accessing C sharp scripts from javascript is now broken something to do with the first pass compile but i’m not positive of that.
does anyone know whats going on here?
Update:
Ok summited a bug report to unity and got this back
Hi,
This is a known limitation, standard assets haven’t been adapted for flash just yet. We’re working on this for future builds.
Thanks for the reply unfortunately the project i'm useing was writen for IOS so its already writen with strict typeing.
And the specific compiler errors are
Assets/Standard Assets/Detonator/TestScene/DetonatorTest.js(102,93): BCE0019: 'size' is not a member of 'UnityEngine.Component'.
Assets/Standard Assets/Detonator/TestScene/DetonatorTest.js(105,63): BCE0019: 'detail' is not a member of 'UnityEngine.Component'.
However after some experimentation the root cause seems to be that C# classes stored in standard assets are no longer accessable to JS scripts.
if you import the explosion framework i've linked to above into a blank project and try and compile the test level to flash that will reproduce the error and you can have a play.
I should add that the same project will compile to exe, unity webplayer, ISO etc without throwing any errors.
Can you tell us what specific error the compiler is returning?
If you read the release notes for 3.5, they state that they’ve moved to pragma strict for all Javascript files, whereas this wasn’t required before.
Creating a new JavaScript automatically adds #pragma strict by default.
I would not be at all surprised if, during the update process, Unity is adding #pragma script to files and this is breaking them. You should hopefully be able to remove this directive and the files will work again. If you can’t do a search for “pragma strict” to see various articles on it. In a nutshell, typecasting is now a lot stricter than it was in older versions of unityscript.
This bug persist in Unity4. I’ve translated the class to C# and now it works ok.
Just delete the file DetonatorTest.js and put the attached DetonatorTest.cs in the same folder. Also in the Main Camera object, replace the original .js Detonator Test behavior with this one. At least, it worked for me.