Forum rules - please read before posting.

Done something stupid, don't know what but it's broken my game quite badly

Hi.

I have a game set across several scenes. I'm using Unity 2020.3.22f1 and AC 1.74.5 on Windows 10.

Today, I've been working almost exclusively on just one scene, setting up a Sudoku puzzle using menus and text inputs. When I test the scene in the editor, it works fine including the new stuff done today.

I tried to build the project and got five errors which I foolishly did not make a note of; it failed quite close to the end as far as I could tell. I tried again and it appeared to work as the WebGL localhost popped up and loaded the game.

However, loads of features are now broken. The first scene that is loaded when playing the game properly is the title screen (not what I was working on today) but the menu that should appear is now missing, hotspots are not being registered when the mouse cursor crosses over them and the music does not play; these things are normally controlled via an AC AL. Other things that aren't AC-specific, like the animations in the scene, are still working.

If I try to test the title screen scene in the Unity editor, I get the same problems. The console shows the following error:

NullReferenceException: Object reference not set to an instance of an object.

If I double-click on the error in the console, the "GameEngine" object in the scene hierarchy flashes and "Menu.cs" opens in Visual Studio and goes to line 409 which reads:

_element.LoadUnityUI (this, RuntimeCanvas, addEventListeners);

If I try to run any scene in the editor other than the one I have been working on today, the player isn't loaded and it seems that no AC-based stuff happens but other things like animations do continue to work. The same null reference exception also happens and goes to the same line of code when double-clicked.

When I play the scene I have been working on today in the editor, it works fine including the AC-based stuff, but when I click on a door to go into another room (and load a different scene), the player is not loaded and the AC-based stuff stops happening.

I've checked that the AC Managers are still in place and it appears that they all are.

I can be a bit clumsy (thanks for nothing, Disability) so it may be a finger slip but I have no idea where to look beyond the AC Managers. If anyone has any suggestions, they would be very much appreciated so please let me know if more information is needed. Thanks.

Comments

  • Is that the only Console error that shows? Share all of them if there are more - including their stacktraces, which appear when you select them. The stacktraces help to learn not just what the error is, but what's calling it.

    The error you're getting suggests that (at least one) of your Menus has become corrupted with a "null" element. As a temporary measure, try switching your Menu Manager's asset file over to that of the Demo game, Demo_MenuManager.

    We can see about fixing any problematic Menus, but we'll first need to isolate the issue. If the game continues to throw errors (aside from your game's interface now being different), share them here and we'll work through them.

  • Thanks very much for the reply @ChrisIceBox.

    Yes, it was the only error. There were also two yellow warnings but I think only one was relevant; it was for the menu I was working on yesterday and said no linked canvas could be found.

    I say "was" because, thanks to the guidance you provided above, I realised that it was a problem with yesterday's new menu after all and put two and two together.

    The menu canvas and elements were in the scene as it isn't going to be used in any other scenes. However, I made it a prefab and updated the menu's manager settings to reflect that. Doing so appears to have fixed all of the issues.

    It does leave me a little stumped about one thing, though. I can't figure out how to get a reference to the text input element (in the now prefabbed menu) into the "First Selected" field in the EventSystem GO in the scene.

    Anyway, thanks very much for the guidance and offer to work through whatever was wrong. Your continued support for AC and its users must be a tremendous undertaking and you're very much appreciated for it. Thanks again.

  • No sweat.

    You can force the selection of a given element with the Menu: Select Action. AC can work with the scene's EventSystem, but I'd recommend letting AC use its own unless you have a specific need to use the default Unity provides.

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.