c# enum variable set to nonthing
An enum is a "value" type in C# (means the the enum is stored as whatever value it is, not as a reference to a place in memory where the value itself is stored). You can't set value types to null (since null is used for reference types only).
That being said you can use the built in Nullable<T> class which wraps value types such that you can set them to null, check if it HasValue and get its actual Value. (Those are both methods on the Nullable<T> objects.
name = "";
Nullable<Color> color = null; //This will work.
There is also a shortcut you can use:
Color? color = null;
That is the same as Nullable<Color>;
Also in C#:
- draw sphere cast unity with program
- add object to list c#
- c# multi threading example
- get user directory of file in c#
- make a list c#
- c# datetime dd/mm/yyy hh:mm:ss
- console application in c# ms crm
- jumping with character controller unity
- how to destroy a gameobject after some hits in unity 3d
- while loop in c#
- c# arraylist to listview
- pass parameter to thread c#
- c# get date without time
- unity c# public all codes
- load scene unity
- c# pass mouse events to parent
- unity normalize vector2
- progress openedge odbc connection string c#
- combine two arraylist c#
- slomotion in unity 3d
- Unity if object doens't exist
- run async methods within a sync process
- how to make a pause feautre in unity
- singleton unity