What is a UnityEvent? A UnityEvent is Unity’s built-in event system which allows you to subscribe to events right in the editor. The Unity UI system commonly uses them for example when a button is pressed: How do I use a UnityEvent in my code? All you need to do, is create a public UnityEvent…… Continue reading Unity – UnityEvent
Category: Programming Languages
C# – Method Overloading
What is Method Overloading? Method overloading is a way to create multiple methods, which have the same but have a different set of parameters. Then, depending on what parameters the developer has given, the compiler will choose the correct ‘overload’, or throw an error if there is no appropriate overload. Is there an alternative? A…… Continue reading C# – Method Overloading
C# – Tasks – Async/Await
What does Asynchronous mean? In general, Asynchronous means that one thing can occur at the same time as another. Within C#, Asynchronous programming allows the developer to be able to wait for a method to complete before continuing execution of the code. When doing this, the application continues running as normal and is useful for…… Continue reading C# – Tasks – Async/Await
JavaScript – Torn City API – Display Cabinet Worth
What is this? This is a simple script which I created for the game Torn City. Each player has the ability to use a ‘Display Cabinet’ to show off their best or rarest items. What this script does is get each items market value, adds it all together and uses an alert box to show…… Continue reading JavaScript – Torn City API – Display Cabinet Worth
Unity – 2D Player Controller
What is this? This is a simple and easy to use 2D Player Controller. It is highly customisable and has easy integration with animations. It features a good set of parameters that can be tweaked within the Inspector as well as being able to hook up events for when the character is Idle, Moving, Jumping…… Continue reading Unity – 2D Player Controller
Fibonacci Sequence (Code Implementation)
Who is Fibonacci? Fibonacci was a Mathematician from the Republic of Pisa or modern-day Italy. He is commonly known for his creation of the ‘Fibonacci sequence’ which was created when studying trends in population growth. What is the Fibonacci Sequence? The Fibonacci Sequence is a series of number beginning at 0 and 1 where the…… Continue reading Fibonacci Sequence (Code Implementation)
C# – Extension Methods
What is an Extension Method? An extension method is a way to add functionality to an existing type which you either do not own the source code for or is already compiled. They are defined as static method and must live within an also static class. The first parameters is preceded by the keyword ‘this’…… Continue reading C# – Extension Methods
C# – Tuples
Tuple A Tuple is defined by Microsoft as: “A tuple is a data structure that has a specific number and sequence of elements”. Within my example, I give my method a return type of ‘Tuple<string, string>’. This means that when I return I have to create a new Tuple with 2 strings as parameters. Within…… Continue reading C# – Tuples
C# – Constructors/Destructors
Constructors A constructor is a method that runs when a class is instantiated. They are commonly used to supply information to store within the class. Within my example below, I created another class called “Student”, which has a constructor (defined by the ‘public Student()’ method signature) which takes 2 parameters. ‘string firstName’ and ‘string lastName’.…… Continue reading C# – Constructors/Destructors
Programming Design Patterns – Singleton
Explanation The Singleton pattern in its simplest form ensures that there will only be a single instance of a specific class. This is a kind of alternative to a static class which also only allows a single instance of a class. Using the Singleton pattern also means that we are able to use its public…… Continue reading Programming Design Patterns – Singleton