Search Unity

[Unity 5.4] Playables very slow initialization in Editor but not in build

Discussion in 'Animation' started by dwit_mass_creation, Aug 3, 2016.

  1. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    After update from 5.3 (change from classes to structs) AnimationClipPlayable and Playable Create functions are very slow in Editor. But in build (PC) everything is fine (better performance than in 5.3).

    Because of this game is nearly imposible to play in Editor, when there are calls to Create (each Create in Editor is about 25ms).
     
  2. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    I've created bug report:
    https://fogbugz.unity3d.com/default.asp?820323_ama5ht1i8atu4s1o

    It tests only Playable.Create method, but AnimationClipPlayable Create has the same problem.

    Code for testing Playable.Create if someone wants to test it:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UnityEngine.Experimental.Director;
    4. using UnityEngine.UI;
    5.  
    6. public class PlayableBug : MonoBehaviour {
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.        
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update () {
    15.  
    16.         if (Input.anyKeyDown)
    17.         {          
    18.             TestPlayable();
    19.         }
    20.     }
    21.    
    22.     CustomAnimationPlayable activePlayable_;
    23.     void TestPlayable()
    24.     {
    25.  
    26.         float _seconds = 0;
    27.         float _timeStart = Time.realtimeSinceStartup;
    28.         for (int i = 0; i < 100; i++)
    29.         {
    30.             if (activePlayable_ != null)
    31.             {
    32.                 activePlayable_.Destroy();
    33.             }
    34.             activePlayable_ = Playable.Create<CustomAnimationPlayable>();
    35.         }
    36.         float _timeEnd = Time.realtimeSinceStartup;
    37.  
    38.         _seconds = (_timeEnd - _timeStart);
    39.  
    40.         Debug.Log("TestResult: " + _seconds + "s");
    41.  
    42.         if (activePlayable_ != null)
    43.         {
    44.             activePlayable_.Destroy();
    45.             activePlayable_ = null;
    46.         }
    47.     }
    48. }