Create Script In Unity:

Create First Script :

Right-click in project panel -create -C# Script. It will create a script with the name NewBehaviourScript. we need to change its name immediately after create it by pressing backspace or simply type the name “Player”.

If we click elsewhere before changing its name then it will be given the name as NewBehaviourScript.

Do as following images, To avoid it.

Create new script
Change its name as soon as it created

Change the name of script :

Even if we couldn’t do it, we can still change the script name as we desire But it needs to change the name at 2 separate locations. only rename script will not work out. we need to change its class name also.

Rename script after it clicks elsewhere.

We need the script name and class name to be the same to be able to work. so after renaming the script name check the class name of that script by opening it and make it is same as the script name.

Script name and Class name of the script to be the same

This is all we have to see carefully before changing the name of the script.

Also some short info:

While changing any variable name or class name in VS-code which holds reference in the project(used in code or other scripts).

  1. Select the name you want to change right-click and select the “Rename symbol” option or press f2.
  2. Then type the name want to change to.
  3. Press enter.

This will replace the name of that variable in all places where it is getting used.

Hope you will find this useful.

--

--

--

Unity Game Developer

Love podcasts or audiobooks? Learn on the go with our new app.

How to Drag & Drop UICollectionView Cells by utilizing DropDelegate and DragDelegate

WebP Image Optimization and the Faster Modern Web

PWQuality: Linux password annoyances

A Somewhat Opinionated Guide to Going Full Stack in Scala

How to integrate a Firebase web app with Azure Active Directory

TryHackMe: Git and Crumpets Walkthrough

Deploy Moon on Azure and Google Cloud

Sports Bike Wallpaper 2022

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sudarshan Thube

Sudarshan Thube

Unity Game Developer

More from Medium

My first game in Unity

What is Cinemachine and Timeline in Unity?

Wall Jumping

Setting up a platformer project in Unity