Varia Random Value
VariaRandomValue
is an especially powerful component of Varia. It does one of the most fundamental operations of procedural generation - it picks a random value from a list of values, then assigns it to a given property.
Usage
First, use the property dropdown to select the specific component and property that should be changed.
Then fill in the values array with possible values. Optionally, Weights can be set to alter the probability of chosing each item.
VariaRandomValue
works with most primitive types (like int
, float
), Unity built in types (like Vector3
) and with GameObjects and components. A few other types work, but aren't supported in the Editor Inspector. It can also set material property blocks.
Warning
VariaRandomValue uses reflection to edit properties. This can cause issues in Ahead-of-time compilation build outputs. The best way to fix this is to add a C# script somewhere in your project that references the properties you want to target, forcing Unity to include them in the final output.
Settings
Target / Property
The target is the Unity component that contains the property you want to edit. It defaults to the relevant component of the game object that the VariaRandomValue component is on, called Self.
Property is a string that records which property on the component to change. It follows a special syntax, but it'll be set for you automatically by picking the property from the dropdown.
Use Weights
By default, each value in the list is equally likely to be picked. If you turn on use weights, then you can set extra values to make some values more or less likely. Each value is picked with frequency proportional to the supplied weight.
Show Thumbnails
Toggles an alternative view of the list showing thumbnails for each value (if available).
Conditions
See Conditions.