- Home /
Creating entities with some variations among them
hello there,
I'm trying how to figure out how to make this. I want to implement a way of generating instances of a given kind, with some differences among them.
For example, let's say we want to put some trees in our terrain. We may want them to be slightly difference, that is, they all have different heights, color, and so on. The different attributes of each tree may be given by random numbers.
I need a general approach, so it can be applied not only to this case but to other kind of entities, like stones, etc...
If I created a prefab, then all related instances would need to have the same attributes, right?
I thought maybe the approach is in the direction of class inheritance, in the sense that maybe making a base class and then a subclass (the trees) where each instance of this class would have a gameObject.
I'k not sure which direction to take to come up with a proper solution
thanks people ;)