public void PlayAnim(string animName, bool loop, bool randomStartFrame = false) { if (!(m_animator2D == null) && !string.IsNullOrEmpty(animName)) { m_animator2D.SetAnimation(animName, loop, false, true); if (randomStartFrame) { int currentFrame = Random.Range(0, Mathf.Min(15, m_animator2D.get_animationFrameCount())); m_animator2D.set_currentFrame(currentFrame); } } }