Class SplineInstantiate
SplineInstantiate is used to automatically instantiate prefabs or objects along a spline.
Inherited Members
Namespace: UnityEngine.Splines
Syntax
[ExecuteInEditMode]
[AddComponentMenu("Splines/Spline Instantiate")]
public class SplineInstantiate : SplineComponent
Properties
Container
The SplineContainer containing the targeted spline.
Declaration
public SplineContainer Container { get; set; }
Property Value
Type | Description |
---|---|
SplineContainer |
CoordinateSpace
The coordinate space in which to orient the instanced object.
Declaration
public SplineInstantiate.Space CoordinateSpace { get; set; }
Property Value
Type | Description |
---|---|
SplineInstantiate.Space |
ForwardAxis
Forward axis of the object, by default set to the Z Axis
Declaration
public SplineComponent.AlignAxis ForwardAxis { get; set; }
Property Value
Type | Description |
---|---|
SplineComponent.AlignAxis |
InstantiateMethod
The instantiation method to use.
Declaration
public SplineInstantiate.Method InstantiateMethod { get; set; }
Property Value
Type | Description |
---|---|
SplineInstantiate.Method |
itemsToInstantiate
The items to use in the instantiation.
Declaration
public SplineInstantiate.InstantiableItem[] itemsToInstantiate { get; set; }
Property Value
Type | Description |
---|---|
SplineInstantiate.InstantiableItem[] |
MaxPositionOffset
Maximum (X,Y,Z) position offset to randomize instanced objects positions. (X,Y and Z) values have to be higher to the ones of minPositionOffset.
Declaration
public Vector3 MaxPositionOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MaxRotationOffset
Maximum (X,Y,Z) euler rotation offset to randomize instanced objects rotations. (X,Y and Z) values have to be higher to the ones of minRotationOffset.
Declaration
public Vector3 MaxRotationOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MaxScaleOffset
Maximum (X,Y,Z) scale offset to randomize instanced objects scales. (X,Y and Z) values have to be higher to the ones of minScaleOffset.
Declaration
public Vector3 MaxScaleOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MaxSpacing
Maximum spacing between 2 generated instances, if equal to the minSpacing, then all instances will have the exact same spacing
Declaration
public float MaxSpacing { get; set; }
Property Value
Type | Description |
---|---|
Single |
MinPositionOffset
Minimum (X,Y,Z) position offset to randomize instanced objects positions. (X,Y and Z) values have to be lower to the ones of maxPositionOffset.
Declaration
public Vector3 MinPositionOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MinRotationOffset
Minimum (X,Y,Z) euler rotation offset to randomize instanced objects rotations. (X,Y and Z) values have to be lower to the ones of maxRotationOffset.
Declaration
public Vector3 MinRotationOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MinScaleOffset
Minimum (X,Y,Z) scale offset to randomize instanced objects scales. (X,Y and Z) values have to be lower to the ones of maxScaleOffset.
Declaration
public Vector3 MinScaleOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
MinSpacing
Minimum spacing between 2 generated instances, if equal to the maxSpacing, then all instances will have the exact same spacing.
Declaration
public float MinSpacing { get; set; }
Property Value
Type | Description |
---|---|
Single |
PositionSpace
Coordinate space to use to offset positions of the instances.
Declaration
public SplineInstantiate.OffsetSpace PositionSpace { get; set; }
Property Value
Type | Description |
---|---|
SplineInstantiate.OffsetSpace |
RotationSpace
Coordinate space to use to offset rotations of the instances.
Declaration
public SplineInstantiate.OffsetSpace RotationSpace { get; set; }
Property Value
Type | Description |
---|---|
SplineInstantiate.OffsetSpace |
ScaleSpace
Coordinate space to use to offset rotations of the instances (usually OffsetSpace.Object).
Declaration
public SplineInstantiate.OffsetSpace ScaleSpace { get; set; }
Property Value
Type | Description |
---|---|
SplineInstantiate.OffsetSpace |
UpAxis
Up axis of the object, by default set to the y-axis.
Declaration
public SplineComponent.AlignAxis UpAxis { get; set; }
Property Value
Type | Description |
---|---|
SplineComponent.AlignAxis |
Methods
Clear()
Clear all the created instances along the spline
Declaration
public void Clear()
Randomize()
Change the Random seed to obtain a new generation along the Spline
Declaration
public void Randomize()
SetDirty()
Set the created instances dirty to erase them next time instances will be generated (otherwise the next generation will reuse cached instances)
Declaration
public void SetDirty()
UpdateInstances()
Create and update all instances along the spline based on the list of available prefabs/objects.
Declaration
public void UpdateInstances()