Forum rules - please read before posting.

Graphic Options Template (Download) Import Error

2

Comments

  • There's an easier way to do this: just import the package into a newer Unity version, and compare it with the one in your project.

  • Thankyou @ChrisIceBox , I have finally got the basis of the UI in place in 2018.4, there's just a few hiccups I'm having:

    • For Resolution, the dropdown has quite a few options, but when using direct-controlled menus, there is no way to scroll to the options below. I would have thought the Scrollbar would follow whatever is highlighted, but it does not, it only works by manually scrolling with the mouse.

    • I have test scene with a trigger, when I enter the trigger to turn on the Graphic Options menu I get this:

    NullReferenceException: Object reference not set to an instance of an object
    UnityEngine.UI.Dropdown.set_value (System.Int32 value) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Dropdown.cs:394)
    AC.GraphicOptions.SetDropdownValue (UnityEngine.UI.Dropdown dropdown, System.Int32 value) (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:203)
    AC.GraphicOptions.UpdateUIValues () (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:156)
    AC.GraphicOptions.OnEnable () (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:29)
    UnityEngine.Object:Instantiate(Canvas)
    AC.Menu:LocateLocalCanvas() (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:3190)
    AC.Menu:LoadUnityUI(Boolean) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:387)
    AC.Menu:TurnOn(Boolean) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:1898)
    AC.ActionMenuState:Run() (at Assets/AdventureCreator/Scripts/Actions/ActionMenuState.cs:102)
    AC.d__36:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:455)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:405)
    AC.ActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:372)
    AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:273)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:236)
    AC.AC_Trigger:Interact(GameObject) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:316)
    AC.PositionDetectObject:Process(AC_Trigger) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:631)
    AC.AC_Trigger:_Update() (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:93)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:234)

    I also get this one:

    NullReferenceException: Object reference not set to an instance of an object
    AC.GraphicOptions.SetDropdownValue (UnityEngine.UI.Dropdown dropdown, System.Int32 value) (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:201)
    AC.GraphicOptions.UpdateAdvancedUIValues () (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:168)
    AC.GraphicOptions.UpdateUIValues () (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:160)
    AC.GraphicOptions.OnEnable () (at Assets/AdventureCreator/Downloads/Graphic options template/Scripts/GraphicOptions.cs:29)
    UnityEngine.GameObject:SetActive(Boolean)
    AC.Menu:EnableUI() (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:561)
    AC.Menu:TurnOn(Boolean) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:1963)
    AC.ActionMenuState:Run() (at Assets/AdventureCreator/Scripts/Actions/ActionMenuState.cs:102)
    AC.d__36:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:455)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:405)
    AC.ActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:372)
    AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:273)
    AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:236)
    AC.AC_Trigger:Interact(GameObject) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:316)
    AC.PositionDetectObject:Process(AC_Trigger) (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:631)
    AC.AC_Trigger:_Update() (at Assets/AdventureCreator/Scripts/Logic/AC_Trigger.cs:93)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:234)

    I am not using Anti-Aliasing (I don't see how it could work in my case as I'm using the Post-Processing to decide the AA) so I have disabled it in the prefab and removed all scripts from all it's elements, so perhaps this is what's causing the warnings, not sure.

    • Image and Toggle components do not have the "Masked" option in 2018.4 (though that is obviously a Unity version issue, not related to AC)
  • For Resolution, the dropdown has quite a few options, but when using direct-controlled menus, there is no way to scroll to the options below.

    Unity's ScrollBar doesn't provide this behaviour built-in, you'd need to attach a script to handle this.

    I have test scene with a trigger, when I enter the trigger to turn on the Graphic Options menu I get this

    The first error is coming from Unity itself, so it may not be possible to fix. To be clear, what is on line 203 of your modified GraphicOptions script?

    I am not using Anti-Aliasing

    You will need to modify the GraphicOptions further to remove references to AA, as it will still try to access the AA Dropdown regardless of the other scripts being removed.

  • On line 203 is:
    dropdown.value = value;

    It is a line from your suggested edit to provide compatibility with 2018.4 (which is working btw):

    void SetDropdownValue (Dropdown dropdown, int value)
    {
    Dropdown.DropdownEvent oldEvent = dropdown.onValueChanged;
    dropdown.onValueChanged = null;
    dropdown.value = value;
    dropdown.onValueChanged = oldEvent;
    }

    For the ScrollBar issue then, I just made the "template" for the Resolution dropdown enormous and moved the whole Panel up slightly so it fits on screen. I tried to configure it so that the actual scroll handle could be selected and dragged by keyboard/controller, but could not figure that out, so I just stuck with the first solution.

    I'll get to work on removing all references to AA from the code.

  • On line 203 is:

    Recreated. Replace:

    dropdown.onValueChanged = null;
    

    with:

    dropdown.onValueChanged = new Dropdown.DropdownEvent ();
    

    For the ScrollBar issue

    I've updated the template to allow for auto-scrolling of the Dropdown.

  • Ok great, is there a way I can get that updated template without losing what I've made?

  • Import the AutoScroll script and attach it to your Resolution dropdown.

  • edited December 2022

    Thank you, the scroll bar now works with direct control.

    I have another issue though, I am having trouble selecting the Full Screen toggle with direct control. If I press "up" from the Apply button (near the bottom), then I can select it, but I cannot select it via scrolling through the rest of the options - e.g moving down from Resolution will skip it and go straight to Quality.

    https://imgur.com/a/pYf3zQ3

  • Check your Navigation settings on each of the Selectable components (Button, Dropdown etc). The template has these set to Explicit, but you may need to play around with these if you're using your own prefab.

  • Thanks for the advice, I have navigation working now. It turns out that Explicit actually works better for me, as specific components are chosen to ensure reliable navigation.

    However, a much bigger issue I have is that direct control does not initially work when the menu is opened. You have to move the (invisible) mouse over a component and select it, then direct control begins to work as it should.

    I have Auto-select first visible element checked, but have also tried it disabled and instead directly specified an element to select. Whilst it does work that the element is highlighted when the menu opens, once you actually move (or press interact) direct control of the menu seems to stop functioning - until you rectify it with the previously mentioned mouse thing.

    It's weird, because it works on Rewired control mapper UI without having to do the mouse clicking.

  • You can try using the Menu: Select Action in the Menu's "ActionList when turn on" asset field, but it looks like it might be related to Rewired as I can't recreate the issue.

    AC's built-in EventSystem will force the control of menus to either mouse or keyboard/controller, depending on settings - as opposed to Unity's default behaviour of allowing both. If Rewired has its own EventSystem, that may be creating a conflict.

  • Menu: Select does not work I'm afraid. Well, it does and I hear my hover sound, but the same issue presents itself.

    My EventSystem has both AC's Optional Mouse Input Module & Rewired's Standalone Input Module. I also have this "Module Controller" script on it (you may recall writing it earlier this year in this thread) that allows you to switch between the AC & Rewired modules with an object: send message action - this is what I use for Rewired's Control Mapper, and it works great.

    I have tried using this same method for the Graphic Options menu, since it uses Unity UI, but for some reason I having this issue.

    Another thing I have tried is enabling the cursor & disabling the cursor lock, but for some reason the AC cursor displayed on screen does not line up with the actual position of the cursor, if that makes sense. It moves at the same time, but is somehow out of sync.

    I'm not sure what else I can try right now- I would have had less problems if the Graphic Options menu was just an AC menu I think. No Rewired / EventSystem woes to deal with.

  • My EventSystem has both AC's Optional Mouse Input Module & Rewired's Standalone Input Module.

    Which is enabled at the time the Graphic Options Menu is turned on?

    Try temporarily doing without Rewired - clear the EventSystem prefab from the top of the Menu Manager, and create a fresh scene without any Rewired scripts.

    Another thing I have tried is enabling the cursor & disabling the cursor lock, but for some reason the AC cursor displayed on screen does not line up with the actual position of the cursor

    Is your "Input method" is set to "Keyboard Or Controller"? If so, then the cursor is simulated - as it can be controlled both by any input device.

  • Which is enabled at the time the Graphic Options Menu is turned on?

    Rewired module is turned on when the menu is turned on, though I have tried both modules.

    Try temporarily doing without Rewired

    Can confirm some success with navigation, but it will only work via controller for some reason, and seems to rely on what is set in the project's input rather than Rewired's mappings (I suppose that's expected though).

    Is your "Input method" is set to "Keyboard Or Controller"?

    Yes it is.

    I do believe I've found a solution though. On the "Optional Mouse Input Module", by default the Submit button is set to the Submit input. If I changed this to InteractionA - the same as the Rewired input module, then the menu seems to work perfectly fine, doesn't lose focus/selection etc.
    I would have thought this would only affect the actual clicking/interaction of the buttons, but it seems disrupt control of the whole menu if they're not the same.

    The only thing now is, I keep getting a warning from AC that "InteractionA is not setup" but I need that to not be in the input settings, so as to not cause a clash between Rewired.

    Image

  • If you're having no issues outside of the warning, I expect it's safe to ignore.

  • edited May 2023

    This still works perfectly fine in Editor but for some reason, in a build, this issue is back:

    _Direct control does not initially work when the menu is opened. You have to move the (invisible) mouse over a component and select it, then direct control begins to work as it should.

    I have Auto-select first visible element checked, but have also tried it disabled and instead directly specified an element to select. Whilst it does work that the element is highlighted when the menu opens, once you actually move (or press interact) direct control of the menu seems to stop functioning - until you rectify it with the previously mentioned mouse thing.

    It's weird, because it works on Rewired control mapper UI without having to do the mouse clicking._

    Do you have any ideas as to why this would be different in a build?

  • All I can think is that its some combination of settings unique to your project. Was it previously working in builds, and what about other UI-based Menus?

  • edited May 2023

    This is the first build I have tried since implementing this menu, there are no other UI-based menus in my project.

    I just checked in the editor version and for some reason my "action list to run when turn on / off" were not assigned in the fields, I wonder if they were removed somehow during the build process?

    Anyway, I have it working in the editor (again) but now I have a different issue:
    The GraphicOptions menu won't turn off. I have even set an extra action to turn it off when closing the pause menu, but it just re-opens.

    It goes like this:

    *I press the back button
    *The pause menu is opened, GraphicOptions is closed
    *I press the resume button to close the pause menu
    *Pause menu closes, GraphicOptions re-opens

    So I can't try another build (which takes around 4 hours these days) until this is resolved.

  • What is the Menu's Appear type set to?

    If Manual, it should only turn on either due to a custom script, or use of the Menu: Change state Action.

    You can find references to the Menu by clicking the cog beside it in the Menu Manager and choosing "Find references".

  • The Appear type is set to manual (I made a Graphic Options button for it in the pause menu). The only references to it are in the action lists for the opening and closing of this menu.

    So, I made another build and it seems to work until I open the Controls menu (which is actually just Rewired's Control Mapper). This suggests to me that the Event System is either not being included in the build, or the action list(s) that reference it is somehow losing reference to it after a build is made.

    Would the Event System need to be placed in a Resources folder perhaps? Currently it is not - the only things I have in Resources folders are dialogue and materials I think.

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.