Search Unity

Question Unity 3D all scripts not working

Discussion in 'Editor & General Support' started by Jasrusso17, Apr 14, 2021.

  1. Jasrusso17

    Jasrusso17

    Joined:
    Apr 14, 2021
    Posts:
    2
    hey I need help I've just installed unity opened up a brand new document (so nothing in here and its the first project on my computer) my work space added 1 game object into it created a script call script and I get the error
    script doesnt inherit a native class that can manage a script

    BEFORE YOU SAY RESTART OR CHECK THE NAME OR MONO, I havnt touched anything in the script its legit the plane script no errors no code and its bugged. I've tried restarting. I've tried reimporting, I've tried completely deleting everything to do with unity and reinstalling and it and ive tried 6 different versions. I get the same error no matter what

    Ontop of this my other computer can get past this but every script has a missing class even when it is just created ive done everything stated above for this aswell.


    For some reason I can only use version 2019.4.15f1 and thats it. however now Im constantly getting the 2nd problem with script class not being found
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,735
  3. Well, in order to help you we need hard data, the description is secondary. So please, copy paste the complete error message from the console, the C# file full name and submit the content here in a post using code tags (you can find the button in the post editing toolbar).
     
  4. Jasrusso17

    Jasrusso17

    Joined:
    Apr 14, 2021
    Posts:
    2
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class NewBehaviourScript : MonoBehaviour
    {
    // Start is called before the first frame update
    void Start()
    {

    }
    // Update is called once per frame
    void Update()
    {

    }
    }

    no console errors as well, I tried deleting the Void update and saving and it still wont give any errors because it says the code is fine and should work. If I force a error it comes up and tells me to fix it but that's about it
     
  5. Valjuin

    Valjuin

    Joined:
    May 22, 2019
    Posts:
    481
    Are you renaming your script in the project window after creating it, rather than naming it straight away when first created and the name NewBehaviourScript is still in blue?

    See screenshots.
    upload_2021-4-15_15-12-12.png upload_2021-4-15_15-12-48.png
     
  6. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    We still need the file name, which Ninja already asked for. The issue is if your filename is anything other than exactly NewBehaviourScript.cs, then that is the problem. For scripts which inherit from MonoBehaviour, the filename must match the class name exactly.

    If you want to rename it, you have to change both the filename and the class name together, and make sure they match.

    See the documentation on creating and using scripts for more information
    https://docs.unity3d.com/Manual/CreatingAndUsingScripts.html
     
    Last edited: Apr 15, 2021