Table of Contents

Class MeshLibrary

Namespace
Godot
Assembly
GodotSharp.dll

A library of meshes. Contains a list of Mesh resources, each with a name and ID. Each item can also include collision and navigation shapes. This resource is used in GridMap.

public class MeshLibrary : Resource, IDisposable
Inheritance
MeshLibrary
Implements
Inherited Members

Constructors

MeshLibrary()

public MeshLibrary()

Methods

Clear()

Clears the library.

public void Clear()

CreateItem(int)

Creates a new item in the library with the given ID.

You can get an unused ID from GetLastUnusedItemId().

public void CreateItem(int id)

Parameters

id int

FindItemByName(string)

Returns the first item with the given name.

public int FindItemByName(string name)

Parameters

name string

Returns

int

GetItemList()

Returns the list of item IDs in use.

public int[] GetItemList()

Returns

int[]

GetItemMesh(int)

Returns the item's mesh.

public Mesh GetItemMesh(int id)

Parameters

id int

Returns

Mesh

GetItemMeshTransform(int)

Returns the transform applied to the item's mesh.

public Transform3D GetItemMeshTransform(int id)

Parameters

id int

Returns

Transform3D

GetItemName(int)

Returns the item's name.

public string GetItemName(int id)

Parameters

id int

Returns

string

GetItemNavigationLayers(int)

Returns the item's navigation layers bitmask.

public uint GetItemNavigationLayers(int id)

Parameters

id int

Returns

uint

GetItemNavigationMesh(int)

Returns the item's navigation mesh.

public NavigationMesh GetItemNavigationMesh(int id)

Parameters

id int

Returns

NavigationMesh

GetItemNavigationMeshTransform(int)

Returns the transform applied to the item's navigation mesh.

public Transform3D GetItemNavigationMeshTransform(int id)

Parameters

id int

Returns

Transform3D

GetItemPreview(int)

When running in the editor, returns a generated item preview (a 3D rendering in isometric perspective). When used in a running project, returns the manually-defined item preview which can be set using SetItemPreview(int, Texture2D). Returns an empty Texture2D if no preview was manually set in a running project.

public Texture2D GetItemPreview(int id)

Parameters

id int

Returns

Texture2D

GetItemShapes(int)

Returns an item's collision shapes.

The array consists of each Shape3D followed by its Transform3D.

public Array GetItemShapes(int id)

Parameters

id int

Returns

Array

GetLastUnusedItemId()

Gets an unused ID for a new item.

public int GetLastUnusedItemId()

Returns

int

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

RemoveItem(int)

Removes the item.

public void RemoveItem(int id)

Parameters

id int

SetItemMesh(int, Mesh)

Sets the item's mesh.

public void SetItemMesh(int id, Mesh mesh)

Parameters

id int
mesh Mesh

SetItemMeshTransform(int, Transform3D)

Sets the transform to apply to the item's mesh.

public void SetItemMeshTransform(int id, Transform3D meshTransform)

Parameters

id int
meshTransform Transform3D

SetItemName(int, string)

Sets the item's name.

This name is shown in the editor. It can also be used to look up the item later using FindItemByName(string).

public void SetItemName(int id, string name)

Parameters

id int
name string

SetItemNavigationLayers(int, uint)

Sets the item's navigation layers bitmask.

public void SetItemNavigationLayers(int id, uint navigationLayers)

Parameters

id int
navigationLayers uint

SetItemNavigationMesh(int, NavigationMesh)

Sets the item's navigation mesh.

public void SetItemNavigationMesh(int id, NavigationMesh navigationMesh)

Parameters

id int
navigationMesh NavigationMesh

SetItemNavigationMeshTransform(int, Transform3D)

Sets the transform to apply to the item's navigation mesh.

public void SetItemNavigationMeshTransform(int id, Transform3D navigationMesh)

Parameters

id int
navigationMesh Transform3D

SetItemPreview(int, Texture2D)

Sets a texture to use as the item's preview icon in the editor.

public void SetItemPreview(int id, Texture2D texture)

Parameters

id int
texture Texture2D

SetItemShapes(int, Array)

Sets an item's collision shapes.

The array should consist of Shape3D objects, each followed by a Transform3D that will be applied to it. For shapes that should not have a transform, use Transform3D.IDENTITY.

public void SetItemShapes(int id, Array shapes)

Parameters

id int
shapes Array