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?()
}
}