Answers for "Unity3D Can I get the same variable in a custom getter"

C#
4

get and set unity

class Thing {
  private int secret; // This is a field.

  public int Secret { // This is a property.
    get {
      Debug.Print("Somebody is accessing the secret!");
      return secret;
    }

    set {
      Debug.Print("Somebody is writing to the secret!");
      secret = value; // Note the use of the implicit variable "value" here.
    }
  }
}
Posted by: Guest on November-04-2020

Code answers related to "Unity3D Can I get the same variable in a custom getter"

C# Answers by Framework

Browse Popular Code Answers by Language