Unity animation failed to animate a script variable on my windows phone

It works just fine in my Unity editor until I deploy the game onto my HTC x8.
Anyone has the same problem?
Any fix?:face_with_spiral_eyes:

For the script variable I mean the public monobehavior variable of course :slight_smile:

My understanding is that the editor uses Mono whereas WP8 device uses a special .NET version.
Is there an error in Visual Studio ?
Can you post the code that is crashing ?

Thx for the reply namine.
The app didn’t crash and there was no error. It’s the animations didn’t alter the public vars of a component.
My game does keep running but it looks weird.

Here, check out this quick example. It runs different on Unity editor and my WP.
https://docs.google.com/file/d/0B2USj7Yn_wYMRkVuMWVOUE5kQlE/edit

Note the float variable is not animated.

This is a limitation of Windows Store Apps, Windows Phone 8 platforms, as namine said WP8 and Windows Store Apps use MS .NET, animating variables requires special feature from framework which is only available on Mono.

You can see unsupported feature list here - http://docs.unity3d.com/Documentation/Manual/windowsstore-gettingstarted.html

It looks like I got to find another way to do it. Thanks.

This is a really sorry limitation. Does anyone have any ways around this? My game kind of relies on this feature so it’ll take a ton of work to redo this animation.

Well, the straightforward fix is to replace your animations with scripts. That’s probably impractical for you if you have lots of complex animations, though.

To work around the issue, I created a system to extract animation curves from animations and save them into adapter scripts that know the variables they’re supposed to modify. Unfortunately, the adapter scripts need to be customized for each variable, since Reflection is not supported in Windows Store apps (which is probably why this limitation exists in the first place).

The gist of the process is:

  1. Editor script reads animation curves from animations, and saves them as new “extracted curve” component on the game object
  2. Remove all extracted curves that don’t need adaptation in the editor (for example, animating the transform)
  3. Write an adapter component that binds the state of the extracted animation curve to the variable you want modified

To cut down on complexity, I have the extracted curve component update itself to match the current animation state at runtime, so the adapter scripts simply read the curve state and apply it and don’t have to worry about timekeeping. Altogether, it’s a bunch of upfront work, but it has the benefit of being easy to reverse once this feature is eventually supported (simply remove all the extracted curve and adapter scripts and let the animations do their thing).