// Use this for initialization void Start() { m_rigidBody2D = GetComponent <Rigidbody2D>(); m_spriteRenderer = GetComponent <SpriteRenderer>(); m_animator = GetComponent <Animator>(); m_smartRectCollider = GetComponent <SmartPlatformCollider>(); m_smartRectCollider.OnCollision += _OnSmartCollision; m_smartRectCollider.OnSideCollision += _OnSideCollision; m_walkingDrag = m_rigidBody2D.drag; VPad.Start(); // Add an offset to horizontal raycasts to avoid missing collisions with lateral moving platforms m_smartRectCollider.SkinRightOff01 = 0.1f; m_smartRectCollider.SkinLeftOff01 = 0.1f; OnStateChanged += _OnStateChanged; SetNextState(eState.Idle); }