Call Sequence of Class Methods – Unity

Right, so classes have a number of methods in them and it can get a bit confusing as to when each of them are called, especially when you require a very specific sequence of events to occur. So let’s say that you are instantiating a prefab from a class method. yourPrefab yPre = Instantiate(yourPrefab, transform.position, transform.rotation);   … Read more

Scriptable Objects – Unity

Scriptable Objects have 2 major uses Saving and storing data during an editor session Saving data as an asset in our project for use at runtime Things to Note In the editor we can save data to the SO during edit and runtime In a deployed build we can only read the data from the … Read more

Static Variables and Methods – Unity

So what does this word “static” do to variables and methods? Well a couple of things. static variables and methods that are public are accessible from anywhere without having to first reference or instantiate the class that they are in. Note though that if they are private, they can not. They make variables class variables, … Read more

Things to Research

input.getaxisraw   [serializeField]   ///<summary>   Scriptable Objects   Editor extensions   [System.serializable]   static   magnitude   ScreenBounds.RANDOM_ON_SCREEN_LOC;   struct   quaternion

Version Control with Collaborate

Common Concepts of Version Control Repository Add Publish Pull Conflict Resolution – Merge History   Connect to Collaborate Click on the services tab (the little cloud in the top right corner). Assign an organisation to your project. Then click on the “Collaborate” tab. Turn on “create together seamlessly”   The arrow on the “collab” button … Read more

Extension Classes – Unity

So these are classes that you write, that extend one of the Unity classes. There’s a good example on one of the Learn Unity tutorial site here. But basically  you will create the class file like this: using UnityEngine;  using System.Collections;      //It is common to create a class to contain all of your      //extension methods. This class must be static.      public static class ExtensionMethods {     //RULE 1 : extension methods must be declared static.      //RULE 2 : The first parameter must have the keyword “this”     //RULE 3 : Follow the “this” with the Class name that you are extending,      // example, Vector3, Transform, Rigidbody     //RULE 4 : Follow the class type with a variable name to use in the method     // then just do whatever you need to in the method as per usual     public static void ResetTransformation(this Transform trans)     {         trans.position = Vector3.zero;         trans.localRotation = Quaternion.identity;         trans.localScale = new Vector3(1, 1, 1);     } … Read more

Monobehaviour – Unity

So I was watching a tutorial and the guys keeps banging on about classes being monobehaviour or not and I started wondering why he was making note of one that wasn’t monobehaviour. So I’ve looked it up on Unity and you can see the whole post here, but the main jist is this. MonoBehaviour is … Read more