Search Issue Tracker

By Design

Votes

1

Found in

4.6.8p3

Issue ID

732663

Regression

Yes

[IMGUI] Crash when calling GUILayout.Button on iOS devices in Unity 4.6 builds

iOS

-

Reproduction steps:
1. Open attached project "IMGUIButtonCrash"
2. Build scene "scene1" for iOS
3. Start the game
- You should see an input field
4. Type in at least 10 characters
- Game crashes

Comments (2)

  1. jesusluvsyooh

    Oct 02, 2015 21:53

    This may sound strange, but i found the cause of bug Case 732663, its the
    inputField.Length>=2
    On the script called fontios, line 70 in the repo project.

    Did a bit of trial and error on the repo project to try narrow it down, removing or moving the inputfield length check stops the crash and everything works fine.
    Removed/moved it on my main project and that now works fine too.
    I have the same "inputField.Length>=2" on various other scripts and projects and they do not crash, so still needs investigating further.

    Original (crashes)
    [code=JavaScript]if(waited && inputField.length >= 2 )
    {
    if ((Event.current.type == EventType.keyDown && Event.current.character == "\n") || (GUILayout.Button("send", GUILayout.Width(35*heightScale), GUILayout.Height(35*heightScale)) ))
    {
    ApplyGlobalChatText("user 1" + ": " + inputField, 0);
    inputField = "";
    ButtonWait ();
    }
    }[/code]

    Also crashed (moved input length check into if statement below)
    [code=JavaScript]if(waited )
    {
    if ( inputField.length >= 2 && ((Event.current.type == EventType.keyDown && Event.current.character == "\n") || (GUILayout.Button("send", GUILayout.Width(35*heightScale), GUILayout.Height(35*heightScale)) )) )
    {
    ApplyGlobalChatText("user 1" + ": " + inputField, 0);
    inputField = "";
    ButtonWait ();
    }
    }[/code]

    Does not crash (moved input check after button and keydown event)
    [code=JavaScript]if(waited )
    {
    if (((Event.current.type == EventType.keyDown && Event.current.character == "\n") || (GUILayout.Button("send", GUILayout.Width(35*heightScale), GUILayout.Height(35*heightScale)) ))) && inputField.length >= 2)
    {
    ApplyGlobalChatText("user 1" + ": " + inputField, 0);
    inputField = "";
    ButtonWait ();
    }
    }[/code]

    If you could pass this message and information on to those in charge of that area, hopefully it will shed some light on the matter.

  2. jesusluvsyooh

    Oct 02, 2015 18:16

    :D this is my bug

Add comment

Log in to post comment