Game.AsymmetricPieceMesh
Assembly: Assembly-CSharp
Namespace: Game.Prefabs
Type: class
Base: ComponentBase
Summary:
AsymmetricPieceMesh is a prefab/component used by the game's net/piece system to indicate that a mesh for a net piece is asymmetric and to control its preferred orientation. It exposes two boolean flags:
- m_Sideways — when true, indicates the mesh should be treated as oriented sideways relative to the piece.
- m_Lengthwise — when true, indicates the mesh should be treated as oriented lengthwise.
This component is annotated with a ComponentMenu attribute that associates it with the net prefab menu (Net/) and the NetPiecePrefab type. The class currently provides empty overrides for GetPrefabComponents and GetArchetypeComponents; modders can populate these to register ECS component types required by their prefab/archetype creation logic.
Fields
-
public bool m_Sideways = true
Controls whether the mesh is considered sideways. Default value is true. Use this to influence orientation selection when the net-piece rendering/generation code examines the prefab. -
public bool m_Lengthwise
Controls whether the mesh is considered lengthwise. Default value is false. Typically used in conjunction with m_Sideways to determine how to place/rotate the mesh for asymmetric pieces.
Properties
- This type does not declare any C# properties. It exposes state via the public fields above.
Constructors
public AsymmetricPieceMesh()
The default constructor is the compiler-provided parameterless constructor. No custom initialization beyond the field defaults is performed.
Methods
-
public override void GetPrefabComponents(HashSet<ComponentType> components)
This override is provided by the prefab/component framework to allow the component to register any ECS ComponentType entries required on the prefab. In the current implementation the method is empty. If your mod needs specific ECS components present on the prefab representation, populate the provided HashSet with the appropriate ComponentType entries here. -
public override void GetArchetypeComponents(HashSet<ComponentType> components)
Similar to GetPrefabComponents, this method is intended to allow the component to register component types required for the archetype used by ECS. It is currently empty. Populate the HashSet when creating archetypes to ensure required components are included.
Usage Example
// Basic usage: configure an AsymmetricPieceMesh on a prefab (conceptual example)
var asymmetric = new AsymmetricPieceMesh();
asymmetric.m_Sideways = false;
asymmetric.m_Lengthwise = true;
// Example of how one might register component types (pseudo-code; adapt to actual ECS API used by the game)
public override void GetPrefabComponents(HashSet<ComponentType> components)
{
// If your prefab needs a specific ECS component to be present, add it here.
// components.Add(ComponentType.ReadWrite<YourRequiredComponent>());
}
Notes and recommendations: - The two boolean flags are simple markers — the actual mesh rotation/placement logic lives elsewhere in the net/piece rendering or generation code. Ensure that code checks these flags when deciding rotation/flip for asymmetric meshes. - If your mod introduces ECS state related to this component (for example runtime orientation state or additional per-instance data), implement GetPrefabComponents/GetArchetypeComponents to include the appropriate ComponentType entries so the ECS archetypes/prefabs are created correctly.