One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

SetEntityEnabledAction

struct · iOS 18.0+ · SDK 27.1

struct SetEntityEnabledAction

An action that enables or disables the targeted entity and its descendants when played as an animation. This action toggles the ``SetEntityEnabledAction/targetEntity`` ``Entity/isEnabled`` flag. Use the animation generated from this action within an animation group to determine when the entity should be enabled, and visible in the scene. The example below creates an animation which disables the entity after five seconds. In this example, the target entity starts enabled. ```swift // Create an action entity resolution. // // The animation will be played from the parent entity. let childEntity: ActionEntityResolution = .entityNamed("childEntity") // Create an action to disable the entity. let disableEntityAction = SetEntityEnabledAction(targetEntity: childEntity, isEnabled: false) // Create a small positive duration value. let duration: TimeInterval = 1 / 30.0 // Create an animation to disable the target entity. let disableEntityAnimation = try AnimationResource .makeActionAnimation(for: disableEntityAction, duration: duration, delay: 5.0) // Play the sequence animation that plays the actions. rootEntity.playAnimation(disableEntityAnimation) ``` @Video( source: setentityenabled-action, alt: "A screen recording of a red cube in a living room scene. At the start, the cube is visibly enabled in the scene. After some time, the cube is disabled; it's no longer visible in the scene.", poster: setentityenabled-action-poster ) - Note: Animations do not play on entities that are disabled. In order to disable, and enable the target entity, play this action on another entity, such as a root entity, or its parent. - Important: This action does not animate a bound property, such as ``BindTarget/transform``. - Tip: This action performs instantaneously, consider supplying a small positive duration value when creating the animation.

Members (5)

get · iOS 18.0+

isEnabled

TypeScript
get isEnabled(): boolean
Swift declaration
var isEnabled: Bool

A Boolean that you set to enable or disable the entity and its descendants.

set · iOS 18.0+

isEnabled

TypeScript
set isEnabled(value: boolean)
Swift declaration
var isEnabled: Bool

A Boolean that you set to enable or disable the entity and its descendants.

init · iOS 18.0+

init

TypeScript
static init(targetEntity: ActionEntityResolution, isEnabled: boolean): SetEntityEnabledAction
Swift declaration
init(targetEntity: ActionEntityResolution = .sourceEntity, isEnabled: Bool)

Creates a new set entity enabled action. - Parameters: - targetEntity: The entity to disable or enable. - isEnabled: A Boolean that you set to enable or disable the entity and its descendants.

get · iOS 18.0+

targetEntity

TypeScript
get targetEntity(): ActionEntityResolution
Swift declaration
var targetEntity: ActionEntityResolution

The entity to disable or enable.

set · iOS 18.0+

targetEntity

TypeScript
set targetEntity(value: ActionEntityResolution)
Swift declaration
var targetEntity: ActionEntityResolution

The entity to disable or enable.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

SetEntityEnabledAction.animatedValueType

Passing a Swift type itself is not supported.

All RealityFoundation types →