Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

RequiredAttribute

A topic by CatyboyStudio created Oct 14, 2022 Views: 81
Viewing posts 1 to 1

If the property is not set, a message is displayed

[Required]
public string Value1;
 
[Required]
public int Value2;
 
[Required("Must select one", MessageType.Warning)]
public Transform Value3;

“Set” judgment is made based on different data types

  • object: not null
  • string: not null and not empty
  • valueType: not equals to default value