Namespace Varia
Classes
VariaBehaviour
Base class for all varia components that actually do something. Simply inherit, and override the Apply() method to make a new component.
VariaCondition
VariaConditionList
VariaContext
VariaDestroy
Destroys the game object. You should add conditions to this component or it is mostly useless.
VariaInstantiate
Picks a random prefab from a list, and instantiates it with VariaUtils.Instantiate. This may recursively instantiate more objects itself, which is tracked as the "depth". After the instantiation, this object is deleted.
Warning: There are some issues with using a target that is a direct parent of this component. To fix this, either make an extra prefab to avoid the issue, or use VariaUtils.Instantiate instead of normal instantiation.
VariaKeep
Destroys the GameObject if the conditions are not met. You should add conditions to this component or it is mostly useless.
VariaMirror
Abstraction for a a readable or writable property of a given instance.
VariaPreviewer
Utility for automatically calling VariaUtils.Instantiate. This is particularly useful in the editor to get a live preview of results.
VariaProperty
A cut down version of System.Reflection.PropertyInfo
VariaPrototype
Add this to any game objects with VariaBehaviours that you want to instantiate multiple times. It disables all VariaBehaviour on this object and children, so it is pristine for copying. It's not necessary for prefabs.
VariaRandomPosition
Offsets the position, randomly
VariaRandomRotation
Rotates the object randomly around a given axis.
Two sorts of rotation are supported:
- Rotating around the axis (rolling) using min and max.
- Rotating away from the axis (pitch / yaw) using dispersionMin and dispersionMax
VariaRandomScale
Changes transform.localScale randomly.
VariaRandomTint
Randomly sets the color of a MeshRenderer or SpriteRenderer component.
VariaRandomValue
Sets any property of any component to a value chosen randomly from a list. Only properties of types subclassing UnityEngine.Object are supported currently.
VariaReflection
VariaReflection is a simplified version of C# reflection, with an emphasis on reading and writing.
The main feature is given a expression, it lets you read and write values for the field corresponding to that expression. An expression is build as follows: expression ::= property_name | property_name "." expression | "propertyBlock" "." material_property_name "." type
The first form indicates a property of the target object itself. The second form evaluates the sub-expression on the value of named property of the target object. The third form corresponds to Renderer.SetPropertyBlock (https://docs.unity3d.com/ScriptReference/Renderer.SetPropertyBlock.html)
Material property block properties behave particularly strangely:
- They must have the type encoded in the name as it's not available at runtime.
- They are not listed when exploring the properties of an object (though you can use VariaMaterialPropertyBlockReflection to get them)