Search Unity

How do i edit scripts?

Discussion in 'Getting Started' started by driepotigeman, Jun 7, 2020.

  1. driepotigeman

    driepotigeman

    Joined:
    Jun 6, 2020
    Posts:
    1
    I'm completly new to unity and i don't know how i can edit the script or how i use script programs.
    Please help?!?
     
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
  3. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    To edit an existing script, you double click the script from within the editor. It will be in the Assets folder (or a subfolder usually, unless you like insanity). This will open your code editor and the script. By default this would be visual studio unless you chose to not install it with Unity or configured Unity to use another code editor.

    To create a new script, you right click under the Assets folder and create the new script there. It will use a template to create a pretty minimal MonoBehaviour class with the same name as the filename you chose. This is a good starting point in most cases. The MonoBehaviour class and the filename need to be identical by the way, so if you change one you need to change the other or Unity has a panic attack ;) .

    Off topic, but I also created this other thread for folks like you. Good luck and have fun!
    https://forum.unity.com/threads/tips-for-new-unity-users.701864/
     
    DauntlessVerbosity likes this.
  4. YT_ShotyZonal

    YT_ShotyZonal

    Joined:
    Jan 24, 2024
    Posts:
    1
    Whenever I do that, it just opens my File viewer How am I supposed to edit it if I'm just viewing it!