Get default value of class member

后端 未结 4 1411
灰色年华
灰色年华 2020-12-16 05:56

Let\'s assume I have a class ClassWithMember

class ClassWithMember
{
    int myIntMember = 10;
}

How do I get the default value 10 of the m

4条回答
  •  无人及你
    2020-12-16 06:30

    You can still use Activator.CreateInstance to create a MonoBehaviour/ScriptableObject and check its values, if it's simply for the sake of checking the default Values. Make sure to use DestroyImmediate afterwards ;-)

提交回复
热议问题