isEnabled
TypeScriptget isEnabled(): booleanSwift declarationvar isEnabled: BoolA Boolean that you set to enable or disable the entity and its descendants.
struct · iOS 18.0+ · SDK 27.1
struct SetEntityEnabledActionAn 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.
get isEnabled(): booleanSwift declarationvar isEnabled: BoolA Boolean that you set to enable or disable the entity and its descendants.
set isEnabled(value: boolean)Swift declarationvar isEnabled: BoolA Boolean that you set to enable or disable the entity and its descendants.
static init(targetEntity: ActionEntityResolution, isEnabled: boolean): SetEntityEnabledActionSwift declarationinit(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 targetEntity(): ActionEntityResolutionSwift declarationvar targetEntity: ActionEntityResolutionThe entity to disable or enable.
set targetEntity(value: ActionEntityResolution)Swift declarationvar targetEntity: ActionEntityResolutionThe entity to disable or enable.
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.