Log inGet started
Package

RenderFeature.component

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

RenderFeature

Runs a .renderFeature render pass for the lifetime of the entity carrying it. A scene's features are listed together, each with its settings, on RenderFeatures; this is the one-feature form. A feature already live on the same asset is adopted rather than stacked a second time.

A render feature is authored content — a .renderFeature asset whose init.luau returns { setup?, render, teardown? } and enqueues GPU passes every frame. This component is the declarative way to keep one running: while it is enabled it applies its asset, owned by its entity, and the asset holds the one feature every application of it joins. Disabling the component leaves the feature, destroying it drops the application, and the last application to leave stops the feature. A feature stopped from outside its asset (a script's renderer.feature.destroy, a render that raised) stays stopped until an application is stated again: the component enabled again, or its feature changed. A render feature is a global pass, so a single component on a single entity drives it for the whole scene.

Fields

FieldTypeDefaultDescription
featureassetRef("renderFeature")noneThe render feature asset to run.

Methods

  • :getHandle() — the live RenderFeatureHandle of the feature this component applies (its guid is the feature's stable id), or nil while its asset runs no feature.

Persist

This component is the persist-side mirror of a live renderer.feature.create(…) call. When you enable a render feature ad-hoc during play, the scene-authoring freeze (tools.sceneAuthoring.acceptChanges) promotes the feature's source into a .renderFeature asset and records it on one entity carrying this component — so loading the scene re-runs the exact same render pass.

Example

local e = entity.spawn("acrylic_pass", {})
e.component.add("@builtin::components.RenderFeature", {
    feature = asset.resolve("acrylic", "renderFeature"),
})