Table of Contents

Class MeshRef

Namespace
S1MAPI.Core
Assembly
S1MAPI_Mono.dll

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

name string

Exact 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

string

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

original GameObject
position Vector3
rotation Quaternion
parent Transform
stripColliders bool

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

name string

Name for the clone

parent Transform

Optional parent transform

stripColliders bool

Whether 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

name string

Name for the new GameObject

parent Transform

Optional parent transform

addCollider bool

Whether 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

name string

Name for the new GameObject

localPosition Vector3

Local position

localRotation Quaternion

Local rotation

parent Transform

Parent transform

addCollider bool

Whether 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

name string

Name for the new GameObject

material Material

Material to apply

parent Transform

Optional parent transform

addCollider bool

Whether 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

string

Operators

implicit operator string(MeshRef)

Implicitly converts MeshRef to its underlying mesh name string.

public static implicit operator string(MeshRef mesh)

Parameters

mesh MeshRef

The mesh reference to convert.

Returns

string