decentraland / unity-explorer

Apache License 2.0
9 stars 10 forks source link

Hot Reload on scene with Video Texture crashes the app after some time #2449

Open pravusjif opened 1 month ago

pravusjif commented 1 month ago

If Material.Texture.Video is being used in a scene, after the scene hot-reloads (sometimes just 3~4 times, other times it takes more than 10), the application crashes and the Player/Editor logs have no data about the problem.

import { MeshRenderer, engine, Material, Transform, VideoPlayer } from '@dcl/sdk/ecs'
import { Quaternion } from '@dcl/sdk/math'
export function main() {
    const videoPlayerEntity = engine.addEntity()    
    VideoPlayer.create(videoPlayerEntity, {
        src: 'https://player.vimeo.com/external/552481870.m3u8?s=c312c8533f97e808fccc92b0510b085c8122a875',
        playing: true,
        volume: 1.0
    })  
    const screen = engine.addEntity()   
    Transform.create(screen, {
        position: { x: 8, y: 5, z: 8 },
        scale: { x: 6, y: 3, z: 1 },
        rotation: Quaternion.fromEulerDegrees(0, 90, 0)
    })  
    MeshRenderer.setPlane(screen)   
    Material.setBasicMaterial(screen, {
        texture: Material.Texture.Video({ videoPlayerEntity: videoPlayerEntity })
    })  
}
pravusjif commented 1 month ago

for some reason now it's very difficult to reproduce, it requires making lots of hot reloads until it breaks.