Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Can't download Images on Release builds

Discussion in 'Project Tiny' started by RobertoPelonara, Mar 26, 2019.

  1. RobertoPelonara

    RobertoPelonara

    Joined:
    Mar 2, 2015
    Posts:
    9
    Hi devs,

    I have a problem with my build, my "Release" build won't download the Image I need, in my debug/development build everything works well and the image is correctly downloaded. Here it is the code I use for downloading and setting up the image in a SpriteRenderer:
    Code (JavaScript):
    1. static downloadCover (world: ut.World){
    2.             let gameInfoEntity = world.getEntityByName("Session");
    3.  
    4.             world.usingComponentData(gameInfoEntity, [game.GameInfo], (gameInfo) => {
    5.             // Create Texture Entity
    6.             let texture2D = world.createEntity()
    7.             world.addComponent(texture2D , ut.Core2D.Image2DLoadFromFile)
    8.  
    9.             world.usingComponentData(texture2D , [ ut.Core2D.Image2DLoadFromFile] , (file) => {
    10.              
    11.                 file.imageFile = gameInfo.gameInfo.cover;
    12.                 console.log(file);
    13.             })
    14.             console.log(world);
    15.             // Load Texture Entity
    16.             world.addComponent(texture2D , ut.Core2D.Image2D)
    17.  
    18.             // Create Sprite Entity
    19.             let sprite2D = world.createEntity();
    20.             world.setEntityName(sprite2D , name+"_sprite2D");
    21.             world.addComponent(sprite2D , ut.Core2D.Sprite2D);
    22.          
    23.             world.usingComponentData(sprite2D , [ut.Core2D.TransformNode , ut.Core2D.Sprite2D] , (node , sprite)=>{
    24.                 sprite.image = texture2D;
    25.                 sprite.pivot = new Vector2(0.5,0.5);
    26.                 console.log(sprite)
    27.             })
    28.  
    29.             var coverEntity = world.getEntityByName("Cover");
    30.             world.usingComponentData(coverEntity, [ut.Core2D.Sprite2DRenderer], (renderer) => {
    31.  
    32.                 renderer.sprite = sprite2D;
    33.                 console.log(renderer.sprite);
    34.             })
    35.         });
    36.         }
    I'm sure all the entities are spawned in the world with these exact names. It gives me no error at all nor a warning.