MeshInstancesResource

This resource type for model components allows you to create GPU instancing for all your models and material resources. It can be used to render a large number of models in a scene, optimizing CPU draw calls to enhance performance. Additionally, it supports reusing instance data.

Types

Link copied to clipboard
object Companion

The companion object for MeshInstancesResource.

Link copied to clipboard
class Instance

Represents a single instance with a ID and a transform.

Properties

Link copied to clipboard
val count: Int

The number of instances in the resource.

Link copied to clipboard
val isEmpty: Boolean

Whether the resource is empty.

Functions

Link copied to clipboard
fun add(instance: MeshInstancesResource.Instance): Boolean

Adds a new instance to the resource.

Link copied to clipboard
open override fun close()

You need to manually release the resource to free the memory it occupies.

Link copied to clipboard

Gets an instance from the resource.

Link copied to clipboard
fun getAllIds(): List<String>

Gets all instances IDs from the resource.

Link copied to clipboard
fun getName(): String

Gets the name of the resource.

Link copied to clipboard
fun remove(id: String): Boolean

Removes an instance from the resource.

Link copied to clipboard
fun removeAll()

Removes all instances from the resource.

Link copied to clipboard
fun update(id: String, transform: Transform): Boolean

Updates an instance in the resource.