8000 GitHub - gucheng0712/SetProperty: A PropertyAttribute/PropertyDrawer combination that allows for properties in Unity
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

gucheng0712/SetProperty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SetProperty

A PropertyAttribute/PropertyDrawer combination that allows for properties in Unity

Example

Unity allows you to serialize private fields with [SerializeField]. Use the new [SetProperty] attribute to have a public property set every time the field is modified in Unity's inspector. NOTE: It is okay to have private setters for public properties. Vanilla classes (i.e. non-MonoBehaviours) also work as well.

[SerializeField, SetProperty("Number")]
private float number;
public float Number
{
	get
	{
		return number;
	}
	private set
	{
		number = Mathf.Clamp01(value);
	}
}

About

A PropertyAttribute/PropertyDrawer combination that allows for properties in Unity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%
0