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: cs.temp.dll.dll
Syntax
public class VariaInstantiate : VariaBehaviour
Constructors
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> targets
Field 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 thenDestroyThis
Field Value
Type | Description |
---|---|
Boolean |
useWeights
If enabled, the weight property alters the probabiliyt of picking that target. Otherwise, they are picked uniformly.
Declaration
public bool useWeights
Field Value
Type | Description |
---|---|
Boolean |
Methods
Apply(VariaContext)
Declaration
public override void Apply(VariaContext context)
Parameters
Type | Name | Description |
---|---|---|
VariaContext | context |