Hello, this issue occurs occasionally, not 100%. There have been about two out of ten runs where the problem occurred. I cannot reproduce the problem 100% through short projects and code. But the good news is that I caught a screenshot of the problem, as shown in the picture. Could you please take a look.
The correct situation is that when the model fades out, the full screen gradually turns black. However, when the model disappears, the outline of the model incorrectly displays the real environment image that the video penetrates.
My model fading code looks like this:
public func FadeOutEntity(
entity:Entity,
duration: TimeInterval = 1.0,
completion: (() -> Void)? = nil
) {
if entity.components[OpacityComponent.self] == nil {
entity.components.set(OpacityComponent(opacity: 1))
}
else{
entity.components[OpacityComponent.self]?.opacity = 1
}
let action = FromToByAction<Float>(
from: 1,
to: 0,
timing: .easeInOut
)
do {
let anim = try AnimationResource.makeActionAnimation(
for: action,
duration: duration,
bindTarget: .opacity
)
entity.playAnimation(anim)
DispatchQueue.main.asyncAfter(deadline: .now() + duration) {
entity.stopAllAnimations()
self.EnableEntity(entity: entity,isEnabled: false)
completion?()
}
} catch {
entity.stopAllAnimations()
EnableEntity(entity: entity,isEnabled: false)
completion?()
}
}