StaticEnvironmentPieceInstance
A class in Root.Township, Alta.Static.
A pooled copy of a static environment piece (rock, plant and so on) placed by world generation. It's the result of a spawn instruction, so undoing the instruction sends it back to the pool.
Constructors
| Member | What it is |
|---|
StaticEnvironmentPieceInstance() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
3 private and internal fields
| Member | What it is |
|---|
private GameObject gameObject | Cached GameObject, set in Initialize so later calls skip the Unity property. |
private StaticEnvironmentPiece piece | The StaticEnvironmentPiece definition this instance came from; Release returns the instance to its pool. |
private Transform transform | Cached Transform, set in Initialize and used by MoveAndEnable and SetScale. |
Properties
| Member | What it is |
|---|
SurfaceMaterial Material { get; } | Surface material of the piece, for sounds and effects. |
Events
| Member | What it is |
|---|
event Action Released | Event declared for when the instance is released; not raised in this class. |
Methods
| Member | What it is |
|---|
StaticEnvironmentPiece CreatePiece() | Returns the piece definition, logging an error if it's missing. |
void Initialize(StaticEnvironmentPiece piece) | Binds the instance to its piece definition. |
void MoveAndEnable(Vector3 position, Quaternion rotation, Vector3 scale) | Places, scales and turns on the instance. |
virtual void Release() | Turns the instance off and returns it to the piece's pool. |
void SetScale(Vector3 scale) | Sets the instance's scale. |
protected virtual void OnValidate() | Editor hook. Empty here. |
1 private and internal method
| Member | What it is |
|---|
private void Alta.Static.IInstructionResult.Undo() | Explicit IInstructionResult implementation: undoing the placement just calls Release. |
Used in
Members of other types that take, return or hold a StaticEnvironmentPieceInstance:
BasicObjectDisplay.staticPieces, GameObjectDistribution.MigrateToStaticEnvironmentPiece, ForestBridges.Option.piece, IStaticEnvironmentPiecePool.Release, StaticEnvironmentPiece.prefab, StaticEnvironmentPiece.Prefab, StaticEnvironmentPiece.Release, StaticEnvironmentPiece.SetPrefab, StaticEnvironmentPiece.Spawn, StaticEnvironmentPiece.stack, SetPrefabModifier.pieces.