Game.Prefabs.MeshType
Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs
Type: public enum (flags)
Base: System.Enum (underlying type: System.UInt16)
Summary:
MeshType is a flags enumeration used by prefab/mesh code to classify what kind of mesh a prefab or mesh chunk represents. Values are bit flags so multiple categories can be combined (for example Object | Net). The enum uses ushort as its underlying storage. Two alias values (First and Last) mirror the lowest and highest defined category values and are likely present to support range checks or iteration.
Fields
-
Object = 1
Represents object-type meshes (buildings, props). Bit flag value 0x0001. -
Net = 2
Represents network meshes (roads, rails, bridges). Bit flag value 0x0002. -
Lane = 4
Represents lane-specific meshes. Bit flag value 0x0004. -
Zone = 8
Represents zoning-related meshes. Bit flag value 0x0008. -
First = 1
Alias for the first/lowest value in the enum (same as Object). Often used for range checks or iteration starts. -
Last = 8
Alias for the last/highest value in the enum (same as Zone). Often used for range checks or iteration ends.
Properties
- This enum defines no custom properties. Standard members inherited from System.Enum/System.ValueType apply (ToString, GetHashCode, HasFlag, etc.).
Constructors
- Enums do not define explicit constructors in C#. Instances are created by assigning enum values or by casting the underlying numeric type.
Methods
- This enum defines no custom methods. Use inherited methods from System.Enum and System.ValueType. Commonly used operations:
- Bitwise operations (|, &, ~) to combine and test flags.
- Enum.HasFlag to test membership (note: HasFlag uses boxing and may be slower than bitwise tests).
Usage Example
// combine flags
MeshType combined = MeshType.Object | MeshType.Net;
// test with bitwise operation (recommended for performance)
bool hasNet = (combined & MeshType.Net) != 0;
// test with HasFlag (clearer but involves boxing)
bool hasLane = combined.HasFlag(MeshType.Lane);
// iterate over possible single-bit values (using First/Last aliases)
for (ushort v = (ushort)MeshType.First; v <= (ushort)MeshType.Last; v <<= 1)
{
MeshType t = (MeshType)v;
if ((combined & t) != 0)
{
// handle present flag t
}
}