void OnEnable()
    {
        EditorAnimator anim = new EditorAnimator();
        FGAnimation    data = (FGAnimation)target;

        play  = false;
        _time = EditorApplication.timeSinceStartup;
        if (data.frames.Length > 0)
        {
            spriteToShow = data.frames[0];
        }
        EditorApplication.update += Update;
    }
    private void Awake()
    {
        if (anim == null)
        {
            anim = new EditorAnimator();
        }
        FGAnimation data = (FGAnimation)target;

        play  = false;
        _time = EditorApplication.timeSinceStartup;
        if (data.frames.Length > 0)
        {
            spriteToShow = data.frames[0];
        }
    }
 void Update()
 {
     if (play)
     {
         double currTime = EditorApplication.timeSinceStartup;
         if ((currTime - _time) >= FGAnimationKeyFrame.FrameTime * 2)
         {
             if (anim == null)
             {
                 anim = new EditorAnimator();
             }
             spriteToShow = anim.LoopAnimationPlay((FGAnimation)target, (currTime - _time));
             //call animator update here
             _time = currTime;
             Repaint();
         }
     }
 }