1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UnityのSimpleAnimationで速度を変える方法

Last updated at Posted at 2019-01-30

##SimpleAnimationのgithubのコードを読みます。

SimpleAnimation.cs
public State GetState(string stateName){ 
        SimpleAnimationPlayable.IState state = m_Playable.GetState(stateName);
        if (state == null) 
            return null; 
        return new StateImpl(state, this); 
}
SimpleAnimationPlayable_States.cs
 public float speed{ 
         get { return (float)m_Playable.GetSpeed();} 
         set { m_Playable.SetSpeed(value);} 
 } 

つまり、変えたいアニメのstate持ってきてspeed項目を変えてあげればいいと。


SimpleAnimation SA;
void Start(){
        SA = GetComponent<SimpleAnimation>();
        SA.GetState ("hogeanime").speed = 2f;
}

これで変えられます。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?