
It is quite often important to know whether a game object is active or not. bool menuStatus = gameobject.activeSelf; gameObject is the game object in the hierarchy. We can use this way to determine whether a gameObject is active or not.
Extension Methods are a feature that adding new methods to an existing class, which class is non-generic but static class. Similar to the extension concept in Swift. Features of Extension methods: * Create a static class to include all the Extension methods we want to create * Extension methods are static * First:
Like many other languages, C# does have the dictionary data type:
Features of Dictionary in C#:
* Not sorted
* Key-value pair
using System.Collections.Generic;
// example of string key and value is string
Dictionary
Image we have a string: 123,456,78,789, we want to change it to an array, we can use the following code: string szTmp="123,456,78,789"; string[] tmp = szTmp.Split(','); for (int i = 0; i < tmp.Length; i++ ) MessageBox.Show(tmp[i]); // print out: // 123
Actions and func are another ways to create delegates. Action is a delegate that points to a method which in turn accepts one or more arguments but returns no value. Func is a delegate that points to a method that accepts one or more arguments and returns a value. * Action