unity class

122

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. */

Comments

Submit
0 Comments