c# - Scripted GUI button doesn't appear on Android -
i'm using unity develop cross-platform application.
i'm using following c# code place button on screen:
void ongui() { float texwidth = m_buttonpano.normal.background.width; float texheight = m_buttonpano.normal.background.height; float width = texwidth * screen.width / 1920; float height = (width / texwidth) * texheight; float y = screen.height - height; float x = screen.width - width; if (gui.button (new rect (x, y, width, height), "", m_buttonpano)) { if (this.tappedonpanobutton != null) { this.tappedonpanobutton (); } m_guiinput = true; } }
also note, added script scene via creating empty gameobject , attaching script it.
it works on pc, on android button doesn't show up. interesting part if tap @ it's location (bottom right corner) functionality preserved, therefore it's custom background texture put on doesn't show up..
also, here's code of attachment of background texture:
m_buttonpano = new guistyle(); m_buttonpano.normal.background = resources.load("gui/buttonpano") texture2d; m_buttonpano.active.background = resources.load("gui/buttonpano") texture2d; m_buttonpano.onactive.background = resources.load("gui/buttonpano") texture2d;
the problem unity bug. after downloading f4 patch, works correctly.
Comments
Post a Comment