Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Animator is not changing any value in structure. And very low fps on windows phone.

Discussion in 'Windows' started by medvedya2012, Dec 14, 2014.

  1. medvedya2012

    medvedya2012

    Joined:
    May 27, 2014
    Posts:
    41
    I created the animation and added to Animator controller. This animation modify properties in Serializable structure. That works on PC x86 application, but on Windows store application(arm and metro) doesn't work.
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. public class TestAnimator : MonoBehaviour {
    5.  
    6.     [System.Serializable]
    7.     public struct AnimationProp
    8.     {
    9.         public float x_position;
    10.     }
    11.     public Transform obj;
    12.     public AnimationProp animationProp;
    13.     void Update () {
    14.         Vector3 currentObjPos = obj.transform.position;
    15.         currentObjPos.x = animationProp.x_position;
    16.         obj.transform.position = currentObjPos;
    17.     }
    18. }
    19.  
    I builded my game for windows phone 8.1 and run it on Nokia lumia 930. And I got very low fps. I builded the application with only one script for showing fps and one UI text with canvas. any way I was getting very low fps about 30-40 fps.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. namespace Medvedya.DebugUtilletes
    4. {
    5.     [RequireComponent(typeof(UnityEngine.UI.Text))]
    6.     public class DrawFPS : MonoBehaviour
    7.     {
    8.  
    9.         // Attach this to a GUIText to make a frames/second indicator.
    10.         //
    11.         // It calculates frames/second over each updateInterval,
    12.         // so the display does not keep changing wildly.
    13.         //
    14.         // It is also fairly accurate at very low FPS counts (<10).
    15.         // We do this not by simply counting frames per interval, but
    16.         // by accumulating FPS for each frame. This way we end up with
    17.         // correct overall FPS even if the interval renders something like
    18.         // 5.5 frames.
    19.  
    20.         public float updateInterval = 0.5F;
    21.  
    22.         private float accum = 0; // FPS accumulated over the interval
    23.         private int frames = 0; // Frames drawn over the interval
    24.         private float timeleft; // Left time for current interval
    25.  
    26.         public UnityEngine.UI.Text text;
    27.         void Start()
    28.         {
    29.             text = GetComponent<UnityEngine.UI.Text>();
    30.             timeleft = updateInterval;
    31.  
    32.         }
    33.  
    34.         void Update()
    35.         {
    36.             timeleft -= Time.deltaTime;
    37.             accum += Time.timeScale / Time.deltaTime;
    38.             ++frames;
    39.  
    40.             // Interval ended - update GUI text and start new interval
    41.             if (timeleft <= 0.0)
    42.             {
    43.                 // display two fractional digits (f2 format)
    44.                 float fps = accum / frames;
    45.                 string format = System.String.Format("{0:F2} FPS", fps);
    46.                 text.text = format;
    47.  
    48.                 if (fps < 30)
    49.                     text.color = Color.yellow;
    50.                 else
    51.                     if (fps < 10)
    52.                         text.color = Color.red;
    53.                     else
    54.                         text.color = Color.green;
    55.                 //    DebugConsole.Log(format,level);
    56.                 timeleft = updateInterval;
    57.                 accum = 0.0F;
    58.                 frames = 0;
    59.             }
    60.         }
    61.     }
    62. }
     
  2. medvedya2012

    medvedya2012

    Joined:
    May 27, 2014
    Posts:
    41
    I tried to run on IOS on iPad Mini, animator works fine with structure values.
     
  3. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,841
    It's a known bug about structs and is being worked on.
    As on performance on the phone, have you used Debug configuration? There is a big performance difference between Debug and Release/Master builds, especialy on lower end-devices like phones.
     
  4. medvedya2012

    medvedya2012

    Joined:
    May 27, 2014
    Posts:
    41
    I had used Debug configuration. I've just builded with "Release" configuration and got good performance.
    Thanks for help.
    I'll be wait for fix bug with struct.
     
  5. vicenterusso

    vicenterusso

    Joined:
    Jan 8, 2013
    Posts:
    129
    Is this fixed?
     
  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    1,841
    Yes, quite a while ago. Unless it's a new corner case.