Class MeshRef
Reference to a static mesh asset in the game (no game logic, just visuals). Unlike PrefabRef, these are raw meshes without NetworkObject or interaction components. Use S1MAPI.S1.Meshes for known Schedule 1 mesh assets.
public sealed class MeshRef
- Inheritance
-
MeshRef
- Inherited Members
Constructors
MeshRef(string)
Create a mesh reference.
public MeshRef(string name)
Parameters
namestringExact mesh/GameObject name in the game assets (e.g., "SM_Prop_Vase_02")
Properties
Name
The mesh asset name in the game
public string Name { get; }
Property Value
Methods
Clone(GameObject, Vector3, Quaternion, Transform?, bool)
Quick static helper to clone an object with modifications.
public static GameObject? Clone(GameObject original, Vector3 position, Quaternion rotation, Transform? parent = null, bool stripColliders = true)
Parameters
originalGameObjectpositionVector3rotationQuaternionparentTransformstripCollidersbool
Returns
- GameObject
CloneVisuals(string?, Transform?, bool)
Clone the entire source GameObject (mesh + hierarchy but NOT game-specific components). This copies the visual structure but strips NetworkObject, interaction scripts, etc.
public GameObject? CloneVisuals(string? name = null, Transform? parent = null, bool stripColliders = true)
Parameters
namestringName for the clone
parentTransformOptional parent transform
stripCollidersboolWhether to remove colliders (default: true)
Returns
- GameObject
Cloned GameObject or null if source not found
FindSource()
Find the source GameObject containing this mesh. Searches through all loaded objects in the scene/resources.
public GameObject? FindSource()
Returns
- GameObject
The source GameObject or null if not found
GetMesh()
Get the Mesh asset directly.
public Mesh? GetMesh()
Returns
- Mesh
The Mesh or null if not found
Instantiate(string?, Transform?, bool)
Create a new GameObject with just the mesh visuals (no game components).
public GameObject? Instantiate(string? name = null, Transform? parent = null, bool addCollider = true)
Parameters
namestringName for the new GameObject
parentTransformOptional parent transform
addColliderboolWhether to add a BoxCollider (defaults to true)
Returns
- GameObject
New GameObject with MeshFilter and MeshRenderer, or null if mesh not found
Instantiate(string, Vector3, Quaternion, Transform?, bool)
Create a new GameObject with the mesh at a specific position/rotation.
public GameObject? Instantiate(string name, Vector3 localPosition, Quaternion localRotation, Transform? parent = null, bool addCollider = true)
Parameters
namestringName for the new GameObject
localPositionVector3Local position
localRotationQuaternionLocal rotation
parentTransformParent transform
addColliderboolWhether to add a BoxCollider (defaults to true)
Returns
- GameObject
New GameObject with mesh, or null if mesh not found
InstantiateWithMaterial(string, Material, Transform?, bool)
Create a new GameObject with the mesh, applying a custom material.
public GameObject? InstantiateWithMaterial(string name, Material material, Transform? parent = null, bool addCollider = true)
Parameters
namestringName for the new GameObject
materialMaterialMaterial to apply
parentTransformOptional parent transform
addColliderboolWhether to add a BoxCollider (defaults to true)
Returns
- GameObject
New GameObject with mesh and custom material, or null if mesh not found
ToString()
Returns the mesh name as a string.
public override string ToString()
Returns
Operators
implicit operator string(MeshRef)
Implicitly converts MeshRef to its underlying mesh name string.
public static implicit operator string(MeshRef mesh)
Parameters
meshMeshRefThe mesh reference to convert.