public float Health
{
get
{
return m_Health;
}
}
Can any1 tell me what does this script means and why and when do you use this kinda function
public float Health
{
get
{
return m_Health;
}
}
Can any1 tell me what does this script means and why and when do you use this kinda function
This is called a property. You use it to control how and when your variables are accessed. Useful for things like data validation ect. Google properties and encapsulation for more info.
this property function allows access to the variable, but limited to read-only.
Unity’s scripting tutorials has the following video tutorial for them.