Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Question How can I resolve a CS0246 bug in my PlayerStateManager Script?

Discussion in 'Getting Started' started by kylec0217, Aug 23, 2023.

  1. kylec0217

    kylec0217

    Joined:
    Feb 4, 2023
    Posts:
    2
    I started out developing in the unity third-person Template and have been building out from that. The Character Controller file got too messy with tons of small conditions that I could handle in a state factory better. I haven't made one before and after setting it up from a tutorial, and moving what I needed from the ThirdPersonController file I got to a point to test it. Unity can't find the StarterAssetsInputs script in my CharacterStateManager file. Here is the line it's mad at.

    Code (csharp):
    1. private StarterAssetsInputs _input;
    I looked up the bug and there doesn't seem to be a ton I can do. I have tried a few things out to fix it. I double checked the spelling, required it like this

    Code (csharp):
    1. [RequireComponent(typeof(StarterAssetsInputs))]
    and moved it in my file structure to be in the same file as my state setup. What can I do to fix it?
    Thank you for your time.
     

    Attached Files:

  2. ijmmai

    ijmmai

    Joined:
    Jun 9, 2023
    Posts:
    188
    Maybe there is a difference in filename and actual class name in that file.
     
  3. AngryProgrammer

    AngryProgrammer

    Joined:
    Jun 4, 2019
    Posts:
    490
    As an error suggests, the class is not available in the actual namespace range. First, you need to check in what namespace is StarterAssetsInputs. If CharacterStateManager is not in the same namespace just add inside using to link StarterAssetsInputs namespace.
     
  4. kylec0217

    kylec0217

    Joined:
    Feb 4, 2023
    Posts:
    2
    Thank you! That fixed it!