Showing posts from October, 2020

Variables in C# script in unity

There are many variables in unity some of them are usual as we use and some are created by unity API common variables are int - all you to store integer value. float - to store float value bool - give only true or false value string -   can store string value other variable are GameObject - it is used for accessing gameObject of unity AudioSource  - using audioSource as a variable Camera - use camera as a variable Using variables in Script you can define variables as <variable> <name> Like in above image i have define a public variable of type String that can store string value. if variable is public then it can be access by other script and value can be change in inspector. if nothing public or private is not written then it will be private variable. You can change variable value in inspector after attaching to a gameObject     When you create a script in unity it will work as a component and as you attach it to a gameObject it will show you all public variables can be edi

how to create a script in unity editor

 Script is life of a game. Script allow you to control you gameObjects as you want. Unity support C# programming language (called as C-Sharp). From this post we will learn scripting in unity. and first part of learning is creating a script so now start creating script. There are some way of creating script let's take a look. 1. You can create a new script by navigating Assets > Create > C# Script    as you click on C# Script a new script will be created in project panel with a name newMonobehaviorScript to rename you have to give a name to script whatever you want. 2.  You can also create a script by clicking on plus(+) icon in top left corner of project panel and  click C# Script  to create a new script when you click c# script it will prompt to rename it. 3. There is a other way of creating a script in unity by right clicking in project panel and then clicking C# Script will create a new script. These are some way of creating a script now let take a look what a script conta

Scene Visibility in unity editor

You can hide or show gameObjects by Unity scene visiblity it is very useful in creating complex scenes where it is difficult to see specific gameObjects. In the above image you will find an icon look like eye at very beginning of each gameObject in hierarchy window. You can hide or GameObject in scene view by by just clicking on that eye. if you click on a parent gameObject to hide it will also hide its all child object. You will see three type eye  1. One which is fully visible eye that show GameObject is visible. 2. Second in which eye is crossed that show gameObject is hided in scene view. 3. Third in which there is  a point at lower end of eye which means one or more child gameObject is hided.  Scene View Control Bar You can control your game audio and lighting enabled and various other options of scene view. These controls affect only game in editor and does not affect build game. Now we will discus all menus one by one Draw Mode Menu First one drop down is used how you want to se