Android [FIXED] Fatal Error...STRING argument is unset - suddenly an issue, wasn't before

Discussion in 'GameMaker Studio 2 Community Tech Support' started by MADEWITHROBOTS, Sep 30, 2019.

Tags:
  1. MADEWITHROBOTS

    MADEWITHROBOTS Member

    Joined:
    Sep 30, 2019
    Posts:
    2
    Hello, I have searched for an answer to this but I'm lost and so posting here in hopes someone can help.

    My game is live on the Google Play Store, and has been functioning fine. However, after uploading an update, the game now crashes at launch on an Android device and gives the following error message:

    ######################################
    FATAL ERROR in
    action number 1
    of Draw Event
    for object oHighscore:

    STRING argument is unset
    ######################################
    ---------------------------------------------------------------
    called from - gml_Object_oHighscore_Draw_0
    (line 6)

    Everything was fine with previous versions of the app, all that changed between the versions was that I created a new object (unrelated to the one in the error message above) to handle signing in to Google Play Services. There are no errors when I run the game on my PC, I have been building and compiling in the same way each time and not had this error before. When the update went live and I saw this issue, I removed the new object, essentially returning the game to it's previous state. I submitted that as an update, but this error message is still appearing.

    Here is the code for the object oHighscore - this is all of it, and it occurs in a Draw event:

    draw_set_font(fHighScore)
    draw_set_halign(fa_right)
    draw_set_valign(fa_top)

    draw_set_colour(c_dkgray)
    draw_text((x+1),(y+1),"Hi-Score: " + string(global.Best))

    draw_set_colour(c_white)
    draw_text(x,y,"Hi-Score: " + string(global.Best))

    As noted, there have been no issues with this code prior to the last couple of updates, and this code has been in the game since very early on. There are no issues running the game on my PC.

    Also, the object oHighscore is not created until the 3rd room of the game, but this error is triggered from the game booting and it never gets to even load the first room.

    In that 3rd room is also an object called oMenu, which has the following code in a Create event:

    //Stop all sound
    audio_stop_all()

    //Read highscore from file
    ini_open("highscore.ini");
    global.Best = ini_read_real("Score", "Best", 0);
    ini_close();

    //Enter current highscore into highscore table
    highscore_add(global.Best,global.Best)

    audio_play_sound(aMenuMusic,1,true)

    I am totally new to all this, having never coded anything before this project, so if I've omitted any useful information from this post please let me know. Hope someone can help, and thank you in advance.
     
  2. MADEWITHROBOTS

    MADEWITHROBOTS Member

    Joined:
    Sep 30, 2019
    Posts:
    2
    EDIT - RESOLVED: I've fixed the issue, leaving this thread up so that anyone with a similar problem looking for help might find it. I did not find this answer in any of the threads I found while searching before posting here, but this worked for me and so could be valuable to someone else.

    Since the error made no sense, and I couldn't find an answer from searching the error message, I was racking my brain trying to think of what I might have done differently during the compile compared to all other builds - I didn't use the 'Clean' function in GameMaker before compiling the build, in both of the builds that had errors.

    It occurred to me that I hadn't done this simple step just on these occasions, and so it was worth a try. So I hit 'Clean', compiled the apk as usual, uploaded it, it's been published, I've downloaded it and it works, the error is gone.

    Can't believe something so basic could completely break my game like that, but that's code I guess. Lesson learned. I didn't see any mention of using the 'Clean' function anywhere I looked when searching this error, so it bears repeating - always run a clean build when you compile for release!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice