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

"Bad canvas size at init." error on iOS device

Discussion in 'Project Tiny' started by BenJuicy, Aug 5, 2021.

  1. BenJuicy

    BenJuicy

    Joined:
    Mar 16, 2020
    Posts:
    6
    I'm trying to make an Ironsource playable ad but when I use their test app to load my playable I have the error "Bad canvas size at init". The error is only on iOS, the playable works fine on a mac/computer browser and on an android device. Does someone know how I can make it work on iOS ? (By the way the error is only present if I build with "Auto resize frame".
     
  2. BenJuicy

    BenJuicy

    Joined:
    Mar 16, 2020
    Posts:
    6
    If anyone has the problem: In some case the function that sets the size of the canvas (HTML.cs in the Project Tiny for Web) may be call too early. When that happened the frame width & height of the DisplayInfo struct are 0. And when you have Auto Resize Frame enabled the function will try to set the canvas size to (0,0). To fix the issue I copied the function in HTML.cs and modify it so it waits until the frame size is not (0,0) before resizing the canvas.
     
    GilCat likes this.