Class 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.
Inherited Members
Namespace: Varia
Assembly: Varia.dll
Syntax
[AddComponentMenu("Varia/Varia Instantiate")]
public class VariaInstantiate : VariaBehaviourConstructors
VariaInstantiate()
Declaration
public VariaInstantiate()Fields
targets
The list of game objects to instantiate, and their weights. You are recommended to only instantiate prefabs, or objects marked with VariaPrototype
Declaration
public List<WeightedGameObject> targetsField Value
| Type | Description | 
|---|---|
| List<WeightedGameObject> | 
thenDestroyThis
If true, destroys the game object the VariaInstantiate component is on. This can be used to make the instantiation work as a replacement instead.
Declaration
public bool thenDestroyThisField Value
| Type | Description | 
|---|---|
| bool | 
useWeights
If enabled, the weight property alters the probabiliyt of picking that target. Otherwise, they are picked uniformly.
Declaration
public bool useWeightsField Value
| Type | Description | 
|---|---|
| bool | 
Methods
Apply(VariaContext)
Override this to control what happens when all the conditions are met
Declaration
public override void Apply(VariaContext context)Parameters
| Type | Name | Description | 
|---|---|---|
| VariaContext | context |