VisionOS RCP The model fades in and incorrectly displays the model outline on the UI

There is a UI panel with Attachment added in my scene. There are other models in the scene, and when the model fades in using OpacityComponent, the UI panel incorrectly displays the outline of the model, as shown in the red box in the picture. The model fade in code is like this:

public func FadeInEntity(
        entity:Entity,
        duration: TimeInterval = 1.0,
        completion: (() -> Void)? = nil
    ) {
        entity.stopAllAnimations()
        
        if entity.components[OpacityComponent.self] == nil {
            entity.components.set(OpacityComponent(opacity: 0))
        }
        else{
            entity.components[OpacityComponent.self]?.opacity = 0
        }
        
        EnableEntity(entity: entity)
        
        let action = FromToByAction<Float>(
            from: 0,
            to: 1,
            timing: .easeInOut
        )
        
        do {
            let anim = try AnimationResource.makeActionAnimation(
                for: action,
                duration: duration,
                bindTarget: .opacity
            )
            entity.playAnimation(anim)
            
            DispatchQueue.main.asyncAfter(deadline: .now() + duration) {
 
                completion?()
            }
        } catch {
            completion?()
        }
    }

Hi @MaoChao

This looks like it may be related to your other report about the fade artifact in There is a video penetration issue in the gradient area. Please use Feedback Assistant to file a single report that references both forum posts, so the RealityKit team can decide whether they share a root cause.

One experiment worth trying while you wait: instead of calling isEnabled = false after the fade, try removeFromParent() on the entity. This is not a known fix, but easy to try.

VisionOS RCP The model fades in and incorrectly displays the model outline on the UI
 
 
Q