Forum rules - please read before posting.

Menu input broken

Hi Chris,

I think I might've broken something, but I have no idea how, so I'm hoping you could shed some light on my situation! I haven't messed with any code, so I don't think it's anything on that side that could have gone wrong.

I'm using AC for all my menus. Whenever I have an input element in any menu, whether it's an old one or a new one just for testing, I get a continuous flood of critical error messages in my console. As soon as I toggle "is visible?" off, the error stops (but obviously the element on longer functions). If left visible, I can see the element in the editor and at runtime, but using it in any way completely hangs the game.

Here's the error that I get:

NullReferenceException: Object reference not set to an instance of an object
AC.Options.GetLanguageName () (at Assets/AdventureCreator/Scripts/Options/Options.cs:571)
AC.MenuInput.Display (UnityEngine.GUIStyle _style, Int32 _slot, Single zoom, Boolean isActive) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInput.cs:213)
AC.MenuPreview.OnGUI () (at Assets/AdventureCreator/Scripts/Menu/MenuPreview.cs:118)

Comments

  • Does your GameEngine prefab have a "RuntimeLanguages" component on it?  If not, you'll have to add it manually (the asset file is in /Assets/AdventureCreator/Prefabs/Automatic).  This should have occured automatically when you updated - perhaps you didn't import AC fully.
  • edited December 2015
    Thanks for your response, Chris. Apologies for the delay!

    My GameEngine prefab didn't have RuntimeLanguages attached to it; I added it but unfortunately the error is the same.

    Of interest: I tried a separate vanilla project with just AC running, and it also didn't have the RuntimeLanguage component on the GameEngine prefab (as in, it didn't do it automatically), although in that project the menu input works fine. EDIT: Scratch that, not sure why I thought it was working: I just tested a new, blank project as well as the 3D demo's basement scene, and it does the same thing. In this case instead of flooding the console with the same error, it produces the error exactly twice each time I tick the input visibility, or change tabs in the AC Game Editor window with visibility ticked (or if I in any way adjust the Unity layout, such as resizing windows).

    I've tried reimporting AC as well - that didn't work. I also tried a new blank scene in my main project, thinking perhaps it's related to one of my current scenes, and that still didn't work. Same errors each time.

    For the record, I'm using AC 1.49a and Unity 5.2.2f1. I decided to hold off on updating to 5.3 until AC 1.50 is out. But I doubt this problem is related to my versions, as this error starting happening long after my most recent update.
  • Just tried a new 3D demo scene in a new project, with the now updated AC 1.50, fully redownloaded, and it does the same thing :(

    Going to test on a separate PC later, to see if it's my machine or what.

    This is driving me crazy, since it used to work. I can't figure out what caused this.
  • It's my job to be driven crazy by it, not yours!

    Open up MenuInput.cs, and find line 211:
    if (isSelected || isActive)

    And replace it with:
    if (Application.isPlaying && (isSelected || isActive))

    Does that fix it?
  • Thanks Chris, we're definitely getting somewhere. Sadly not resolved yet.

    With that fix, now the menu item at least shows when I choose to enable it. I get no error messages in edit mode, but at runtime, when I actually try to use the input field, I get the same error. Specifically, if I mouse over the input box, it and every other element in the menu (save for the background, which is a menu, not element, background image), disappears and the console floods with the same error message. If I take the mouse cursor away from the input box, the errors stop. It sometimes pops up a few times in the console afterwards, but I think that's owing to my particular actions (I'm using this for custom savegame names, as per the tutorial).

    I also just finished testing this on a brand new installation of Unity 5.2.2 (for consistency's sake) plus AC 1.50a on a separate PC. It does the exact same thing. Starting to wonder how I ever managed to have input fields working in the first place :P

    I'll update to the latest version of Unity on the second machine and test again, just to be certain.
  • Please re-post the error message, in full, that occurs when you get it in-game.
  • edited December 2015
    Ah, my apologies; I thought it was the same error as before, but it's different:

    NullReferenceException: Object reference not set to an instance of an object
    AC.Options.GetLanguageName () (at Assets/AdventureCreator/Scripts/Options/Options.cs:571)
    AC.MenuInput.CheckForInput (System.String input, Boolean shift, System.String menuName) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuInput.cs:265)
    AC.PlayerMenus.DrawMenus () (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:314)
    AC.StateHandler.OnGUI () (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:492)

  • And this is with v1.50a? The line numbers don't match up with mine - what's on Options.cs line 571, and do you have the RuntimeLanguages on PersistentEngine this time also?
  • Ugh, sorry, I was on my main project which is still with 1.49a. I just did that change in a test project on 1.50a and the input seems to work fine!

    I'll update my main project to 1.50a in the next day or two and come back with the results.
  • Okay, updated to 1.50b (thanks for the stealth update!) and Unity 5.3.1 - I'm happy to report that the inputs are working perfectly now! Got a few new problems now, in particular related to UFPS, but I'm still digging around and trying to sort through the simultaneous updates to AC and Unity, so I'll post another thread if I can't come right.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.