Removing States

To completely remove an existing state from the player movement system, follow these steps:

  1. Remove state references in PlayerMain.cs:

    • Open the PlayerMain.cs script.

    • Delete the declaration of the state you want to remove:

csharpCopy codepublic MainState StateNameToRemove;
  • In the Awake() method, remove the state initialization:

csharpCopy codeprivate void Awake()
{
    ...
    // Remove the following line related to the state you want to remove
    StateNameToRemove = new PlayerStateToRemoveState(this, _stateMachine, AnimName.StateNameToRemove, PlayerData);
    ...
}
  • Remove the state from the AnimName enum.

  1. Remove the state script:

    • Navigate to Scripts > State System > Child States.

    • Delete the corresponding C# script for the state you want to remove (PlayerStateToRemoveState.cs).

  2. Remove the state's nested class in PlayerData (if applicable):

    • Open the PlayerData.cs script.

    • Locate and delete the nested class related to the state you want to remove.

  3. Update the animations:

    • Open the "Player AC" located in the animations folder.

    • Delete the state you want to remove from the Animator Controller.

    • Remove the related bool parameter from the Animator Controller's parameters list.

  4. Clean up the project:

    • After completing the above steps, it's a good idea to clean up any remaining references or unused assets related to the removed state.

By following these steps, you will successfully remove the existing state from the player movement system. Be sure to double-check your project for any remaining references to the removed state to avoid potential errors or issues during runtime.

Last updated