Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

"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.