Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

unity class

// Classes are where you store the main program e.g. fields, methods, etc.
// Here are some types of classes: Partial, Private, Public, Sealed, Static.

public class MyClass
{
	// Fields
	public int myInt = 4;
    public int myNextInt = 6;
    public int result;
    public bool myBool = false;

	// Methods
	public void MyMethod()
    {
    	// Method program
        if (!myBool)
        {
        	result = myInt + myNextInt
            Debug.Log(result)
        }
    }
}

/*  Any class member that is set to private can only be accessed by other members of 
that same class. Public classes have the opposite affect. */
Comment

unity how to make a class

public class Stuff
{
  public int bullets;
  public int grenades;
  public int rockets;

  public Stuff(int bul, int gre, int roc)
  {
    bullets = bul;
    grenades = gre;
    rockets = roc;
   }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# copy files from one folder to another 
Csharp :: trim c# 
Csharp :: How to make game object transparent in unity 
Csharp :: The foreach Loop c# 
Csharp :: how to convert object in string JSON c# 
Csharp :: c# array of class 
Csharp :: contains duplicate 
Csharp :: print an array in c# 
Csharp :: c# signalr console app client example 
Csharp :: convert-integer-to-binary-in-c-sharp 
Csharp :: system.net.mail send html message 
Csharp :: c# string list 
Csharp :: c# close form 
Csharp :: rotate gameobject unity 
Csharp :: how get the user show mvc controller core 3.1 
Csharp :: index of c# 
Csharp :: c# clear an array 
Csharp :: cause bsod c# 
Csharp :: unity unfreeze position in script 
Csharp :: switch case with 2 variables c# 
Csharp :: c# get all classes derived from type 
Csharp :: unity respawn c# 
Csharp :: Print arraylist values to console unity 
Csharp :: C# Bitwise Right Shift 
Csharp :: c# get witdh of matrix 
Csharp :: c# winscp upload file 
Csharp :: unity camera fade to black 
Csharp :: c# structure 
Csharp :: how to use double in c# 
Csharp :: adding to a dictionary unity 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =