Search Unity

Canvas freeze on changing GUI inside coroutine (WebPlayer)

Discussion in 'Immediate Mode GUI (IMGUI)' started by Mufan, Sep 16, 2014.

  1. Mufan

    Mufan

    Joined:
    Aug 11, 2013
    Posts:
    15
    Hi!

    I have coroutine. And inside it, after "yield" instruction, I try to change my GUI style.
    Like this
    Code (CSharp):
    1. GUI.skin = customSkin;
    or like this
    Code (CSharp):
    1. GUI.skin.label.normal.textColor = Color.red;
    or smth else.

    This is working correctly in Editor (even with web target selected).
    But if I launch this from browser, I catch canvas freeze.

    Can you help me, please?

    Thanks!
     
  2. Mufan

    Mufan

    Joined:
    Aug 11, 2013
    Posts:
    15
    Ok, try-catch shed some light on this moment:
    "You can only call GUI functions from inside OnGUI"

    Obviously. But...
    Why it is working everywhere except web player?
    Why something like "GUI.Label(...)" is working ok everywhere (even in web player)? Although GUI.Label is GUI function too...