Search Unity

Bug error CS0246: The type or namespace name 'Fallstate' could not be found (are you missing a using dir

Discussion in 'Scripting' started by AEXII, Nov 17, 2022.

  1. AEXII

    AEXII

    Joined:
    Nov 15, 2022
    Posts:
    4
    I've been back and forth over this but I'm pretty sure there isn't an issue.

    I've tried moving the folders, restarting the program/copy and pasting the code from Word Pad just in case but that hasn't changed anything.

    Full error:
    Assets\Movement\PlayerVariables.cs(11,41): error CS0246: The type or namespace name 'Fallstate' could not be found (are you missing a using directive or an assembly reference?)

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6. public partial class PlayerStateManager
    7. {
    8.     #region ConcreteStates
    9.     public WalkState WalkingState = new WalkState();
    10.     public IdleState IdlingState = new IdleState();
    11.     public FallState FallingState = new Fallstate();
    12.     #endregion
    13.  
    14.  
    15.     public CharacterController Controller;
    16.  
    17.     public PlayerInput Input;
    18.     public PlayerBaseState CurrentState;
    19.    
    20.     public Vector3 MoveVector;
    21.  
    22.     public Vector2 InputVector;
    23.  
    24.     public float PlayerSpeed;
    25.  
    26.     public float PlayerRotateSpeed;
    27.  
    28.     private Vector3 _gravityVector;
    29.    
    30. }
     
  2. AEXII

    AEXII

    Joined:
    Nov 15, 2022
    Posts:
    4
    Had to retype the code about 5 times.

    Issue with Unity and Visual Studio communicating.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Common issue. Happens nearly daily.

    This may help you with intellisense and possibly other Visual Studio integration problems:

    Sometimes the fix is as simple as doing Assets -> Open C# Project from Unity. Other times it requires more.

    Other times it requires you also nuke the userprefs and .vsconfig and other crufty low-value high-hassle files that Visual Studio tends to slowly damage over time, then try the above trick.

    Barring all that, move on to other ideas:

    https://forum.unity.com/threads/intellisense-not-working-with-visual-studio-fix.836599/

    Also, try update the VSCode package inside of Unity: Window -> Package Manager -> Search for Visual Studio Code Editor -> Press the Update button

    Also, this: https://forum.unity.com/threads/no-suggestions-in-vscode.955197/#post-6227874