Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Scripted animation not working on [windows phone / windows store apps]

Discussion in 'Windows' started by dorpeleg, Nov 13, 2013.

  1. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    Hello community,

    I have a script that is creating animation at run-time.

    The script has been tested and working on the following:

    Editor (all platforms)

    Android

    iOS

    When trying to run it on either windows 8 phone or windows 8 store, the script isn't working.

    It's not giving any errors or any other indication to why its not working.

    To make it clear: the app is compiled and deployed successfully to a device, just the animation isn't playing....

    The script is pretty big so I don't want to post in here.

    Any ideas? (if there are specific parts of the code you might want to see, let me know)

    Thanks!
     
  2. BFS-Kyle

    BFS-Kyle

    Joined:
    Jun 12, 2013
    Posts:
    883
    What debugging have you done to try to find the issue? Just saying "a script isnt working" without any logs will be very difficult to fix on the forums.

    Try debugging out information throughout the script to see what the state is in various places. It might be failing quietly without you knowing.
     
  3. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    I did that (sorry for not pointing that out).

    All parts of the script are being called, all values are correct... I really couldn't see anything wrong.
     
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,831
    Hi,

    could you copy-past a code snippet how you're creating that animation.

    Just in case, not sure if you're using this exact feature, but animated scripting variables doesn't work on Windows Store Apps/WP8 (the ones animated in Animation Window)

    Cheers
     
  5. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    This is how I do it in it's basic form (I'm aware of animated scripting variables not working and I'm not using such a thing):

    Code (csharp):
    1.  
    2. AnimationCurve posXcurve;
    3. var Xkey = new Keyframe(startTime, fromX, prevInTangent, prevOutTangent);
    4. posXcurve.AddKey(Xkey);
    5. _clip.SetCurve("", type, curve.Key, curve.Value);
    6. _target.animation.AddClip(_clip, _clip.name);
    7. _target.animation.clip = _clip;
    8. _target.animation.Play();
    9.  
    The curve is a Dictionary.
    The key is the property name and the value is the actual curve.

    The _target is the game object that I want to animate.
     
  6. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,831
    I am sorry, but this is exactly animation of scripting variable... " animated scripting variables not working" exactly means that it's currently not possible to animate class properties.
     
  7. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    But I'm animating stuff like "localPosition.x" property...
    if that's not possible, then you can just say: its not possible to create animations via code in windows 8
     
  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,831
    Animating class variables is not possible, it doesn't matter if you attach that animation via Animation windows, or do it through code...
     
  9. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    The localPosition.x is part of the Transform, not any class I made my self.

    And when manually animating it in the animation window, it does work.
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,831
    Just in case submit a bug. Maybe you're right, hard to tell without a repro project.
     
  11. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    Hey, submitted a bug report.

    Case: 576101

    Thanks!
     
  12. TedHoward

    TedHoward

    Joined:
    Nov 19, 2013
    Posts:
    21
  13. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    hmmm, this is interesting, didn't think about trying to look at the animation length.

    I can tell you one think tho, I think the animation is playing, but only te first frame or something like that.

    If you try to do a scale animation and set the first frame to be at a smaller scale then the original scale of the object in the scene, you will see that it does scale down, but if in the animation you scale it up over time, that isn't working.
     
  14. boinged

    boinged

    Joined:
    May 8, 2013
    Posts:
    16
    Hi, can you tell me if this a known Unity issue that will be fixed, or a limitation of the platform?

    It's a bit of a showstopper for us as we're trying to animate alpha of an NGUI component to fade images in and out.

    Thanks!
     
  15. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    Unity replied to my bur report and said they have passed it on the dev team
     
  16. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,831
    We fixed the issue, hopefully it will be available in 4.3.2. Thank you for reporting the bug.
     
  17. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    Great! cant wait :)
     
  18. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    Hey!, just noticed the bug is still on "open" status.
    You might wanna change that ;)
     
  19. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,831
    That's normal, while it's fixed, our QA still needs to confirm that, and only then it will be closed.
     
  20. dorpeleg

    dorpeleg

    Joined:
    Aug 20, 2011
    Posts:
    250
    Ok, cool.
     
  21. Caidezel

    Caidezel

    Joined:
    Dec 7, 2012
    Posts:
    2
    Hey, we had encoutered the same problem here.
    Do you have any idea about Unity 4.3.2 release date ? (i do not wanna solve something that will be fix soon :<)
     
  22. Lomardii

    Lomardii

    Joined:
    Dec 17, 2013
    Posts:
    35
    I confirm that. On WP8 changing variables in scripts via animation in animator "not always" works. Unfortunately it is not deterministic - for some object with controlled script it works, for some its not ;-( But happens in every project I have ;-(

    Tested on 4.3.3f1 with Lumia 720
     
  23. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    Animation works for GameObject components like transform.
    It does not work for public variables in scripts. This is being worked on.
     
  24. Lomardii

    Lomardii

    Joined:
    Dec 17, 2013
    Posts:
    35
    I have manage to bypass this. I'm just using "proxy" object. Animation in animator is setting values in that object and script is reading values from that object. Works like a charm ;-)

    Just add public GameObject proxy. Then create empty game object as children under controller but not in animated object. Set that object to proxy variable in inspector. Animate one of its "default" values. like transform.x. And read values from it by your script.
     
    Last edited: Jan 22, 2014
  25. Lomardii

    Lomardii

    Joined:
    Dec 17, 2013
    Posts:
    35
    There is already 4.3.4 and still no fix for that? This is a critical bug. It is blocker for releasing games on WP8.

    Workaround above is only a proof of concept, but it is not possible to modify all animations in game this way!
     
  26. dis-s

    dis-s

    Joined:
    Mar 25, 2013
    Posts:
    48
    It seems the problem is still there in Unity 4.3.4. Any plans to fix it?
     
  27. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,710
    It will be fixed in 4.5, which will be out soon.
     
  28. dis-s

    dis-s

    Joined:
    Mar 25, 2013
    Posts:
    48
    Thanks, it's a good news. I'll wait for the 4.5.
     
  29. dis-s

    dis-s

    Joined:
    Mar 25, 2013
    Posts:
    48
    Unity 4.5 is released. Does anybody tested it? Is the bug with the animation fixed?
     
  30. Marg

    Marg

    Joined:
    May 28, 2014
    Posts:
    2
    I have a simple sprite with an animation attached (3 frames) that only change the Alpha value of Color property (Sprite Renderer). In Unity 4.3 all work fine, but with Unity 4.5 this animation work in editor, iOS, Android but NOT on Windows Phone!!
    I have to remove 4.5 and reinstall 4.3 to fix.....
     
    Last edited: May 28, 2014
  31. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,628
    Bug report please.
     
  32. Marg

    Marg

    Joined:
    May 28, 2014
    Posts:
    2
    I tried to report a bug, but when I click on 'Report a Bug' menu nothing happens... I can see that the UnityBugReporter.exe is running in my Task Manager but no UI visible... I have Windows 8.1 Professional Update and Unity 4.3.4 (same problem with Unity 4.5).
    How can I do to fix this and report a bug? Thanks
     
  33. talecrafter

    talecrafter

    Joined:
    Mar 26, 2013
    Posts:
    34
    I can confirm that Color Animation of a Sprite does not work in the Windows Store and Windows Phone Player. Uploaded a simple test scene with the Bug Reporter in the Editor.
     
  34. talecrafter

    talecrafter

    Joined:
    Mar 26, 2013
    Posts:
    34
  35. dis-s

    dis-s

    Joined:
    Mar 25, 2013
    Posts:
    48
    I have downloaded Unity 4.5. today and tested my project with it. Now animation works, thanks! It seems now I can start preparing my apps for the Windows Store.