vendredi 29 juin 2018

c# random numbers in abstract properties

How do I create an abstract property that can be a random number?

Parent.cs:

public abstract float ageInYears{get;}

Child.cs:

public override float ageInYears{
     get{
          return Random.Range(0, 10);
     }
}

How do I ensure the stagnation of the random number whenever it is accessed?




Aucun commentaire:

Enregistrer un commentaire