- Home /
Flash compile problem: typeof() does not translate
Hello all, first post here. Bear with me. :)
I am trying to compile my game into a Flash version and, no surprise, there are compile problems with the preview version. I am trying to do a workaround to the Messenger script. When compiling to Flash the function typeof() yields the following error:
(projectpath)\Temp\StagingArea\Data\ConvertedDotNetCode\global\Messenger.as(106): col: 46 Error: Call to a possibly undefined method UnityRuntimeServices_GetTypeOf_Object through a reference with static type Class.
So I tried stuff like ObjectNames.GetClassName() on the class (which extends System.Object), but that yields the following error:
Assets/Assets/Scripts/Messenger/Message.js(20,70): BCE0017: The best overload for the method 'UnityEditor.ObjectNames.GetClassName(UnityEngine.Object)' is not compatible with the argument list '(Message)'.
So the point is to convert the class name into a string somehow. I'm new to Unity so my grasp on JavaScript / C# is shaky as of yet. Cheers in advance for any help!
Answer by HazeTI · Mar 15, 2012 at 08:47 PM
This may help you:
Thanks for your reply, Haze.
We did look into getQualifiedClassName, but the problem is that there's apparently no function on Unity's end that would be converted into getQualifiedClassName upon compile to Flash.
Fortunately I figured out a way to circumvent the issue having slept on it. :)
Answer by Dralamir · Mar 16, 2012 at 08:37 AM
Thanks for the reply, Haze.
Unfortunately we looked at getQualifiedClassName as well, forgot to mention that. The problem with that is that I should have a function that works in JavaScript/C# (instead of typeof) that is converted into getQualifiedClassName upon Flash compilation.
Fortunately, having slept on it I figured out a workaround to circumvent the problem. Obviously a proper solution to the function conversion would be ideal at some point. :)