Forum rules - please read before posting.

Confused About the Playermenu's Script

AC Version:1.78.0
PlayerMeuns.cs line 164
if (newMenu.menuSource == MenuSource.UnityUiInScene)
{
newMenu.LoadUnityUI (false);
}
why set loadUnityUI(false), when menu source is unityScene?

I seted menu's button Click Type = simulateinput,i found it not work,so i saw the code here, but i don't understand why

Comments

  • LoadUnityUI registers the UI object with the Menu - it's a necessary step when Unity UI is involved, prefab or otherwise.

    What is the actual issue you're facing? Be aware that the input you list in the Button's Input axis field relates to the input's label (e.g. "InteractionA"), rather than the key itself (e.g. "mouse 0").

    If you can share details of the issue, as well as screenshots of your setup, I can try to see what's wrong.

  • i make a speech ui gameobject in scene, set a subtitles menu use unityUIinscene,and set a button ,click type is simulate input

    but,the button is not working when i clicked,

    so i found that "newMenu.LoadUnityUI (false)"; false means not add listener,that 's why my button click was not working

    but i neend my button has a click event,even my menu 's type is UnityUiInScene

  • the same way ,if i use unity ui prefab,that's ok
    so,i wish use ui in scene also be ok
    because the difference between 2 ways only ui source type

  • LoadUnityUI () is called for scene-based Menus later - in the PlayerMenus.OnInitialiseScene function.

    I cannot reproduce the issue. Can you share screenshots of your Menu's properties, and does this occur in a backup/duplicate project with the latest AC version installed?

  • I have knew!

    i creat menu by script at runtime, then i call PlayerMenus RebuildMenus,
    if (newMenu.menuSource == MenuSource.UnityUiInScene)
    {
    newMenu.LoadUnityUI (false);
    }
    that's in RebuildMenus

    PlayerMenus.OnInitialiseScene is right ,LoadUnityUI ()

    so rebuildmenu not add the listener,but OnInitialiseScene add listener.

    but i still not understand why rebuildmenu not add listener

  • You do not need to add any custom scripts to get around this - you can leave worrying about the underlying code to me.

    Before I can make any potential changes/fixes to the codebase, however, I will first need to be able to reproduce the original issue.

    If you can share details/steps that show how the underlying issue can be recreated, I will follow them. Alternatively, you're welcome to PM me a .unitypackage of your Manager assets + a scene that contains the UI.

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.