I am currently making a 2D RPG game using Unity.
While creating a status display for an RPG game using the Panel and Button of the UI, the following problem occurred.
-Duplicate the player character and status UI created in a specific Scene (Bar) to another Scene (OSIRO) by copying and pasting.
At that time, even if the status panel is opened in OSIRO, the UI button selection is not successful and the status panel cannot be operated.
Realization of the status panel/execution method on the game is as follows.
(1) Place the status created from Panel and Button of UI in Scene in the inactive state.
② Activate the status panel when Enter is pressed in the script of the player character (execute the script below by writing it in Updated())
if (Input.GetButtonDown("Menu")) // Assign the button name Menu to the Enter key and confirm that it was pressed
{
commandUI.SetActive(true);//Activate status panel
FirstButton1.Select();//Select the initial button on the status panel [Is there a problem? ]
GManager.instance.isStop = true;//Prohibition of player character movement while checking the status panel
}
if (Input.GetButtonDown("Cancel")) // Close the status panel with the cancel button
{
commandUI.SetActive(false);// Deactivate status panel
FirstButton1.Select();//Select the initial button on the status panel [Is there a problem? ]
GManager.instance.isStop = false;//Release movement prohibition of player characters while checking the status panel
}
endregionThe status of the bug is as follows
-It is possible to open the status panel from the Enter key, but the operation is impossible
・Cancel key can close the status panel
・No errors or warnings have occurred.
Especially, I would like to know how to select the UI button when switching the UI active/inactive
Which button is currently selected
Will be.
If there is a point that is difficult to understand, we will correct it if you point out, so we will correct it.
Thanks for your guidance and encouragement.
-
Answer # 1
Related articles
- unity ui: button does not respond when clicked
- Unity implements button scroll effect in roulette mode
- Vue form binding example code (radio button, select box (for single selection, multiple selection, dynamic options rendered with
- Python button select local image and display examples
- layui click reset button, select is not reset
- unity - want to change the button image on the screen by acquiring the image of the object in the list
- i want to select a radio button with tkinter of python and close the window at the same time as getting the value
- unity - direction to make button images shine periodically
- c # - [unity] i want to push the button attached to the dynamically generated prefab to destroy another dynamically generated pr
- c # - wait for input until unity button is pressed
- select unity and character controller creation method
- c # - i want to play the animation by pressing the [unity] button
- unity - attack se is played by pressing the button on the result screen
- xcode - i want to be able to press a button and select a different mp3 file to play
- record how far unity is cleared reflect on select screen playerprefs
- unity - when i press a button, i want to copy the same image (image) as the pressed button to another button
- unity2d - 2d unity game button display hiding does not work
- c# - navigation setting of button does not work well in unity ui
- java - the value specified by select button is not registered in db
- about unity text component
- c# - i want to delete from the last added one in list
- c# - how do i map enum enumerators to dropdown text?
- when building for pc with unity, i want to clear the display of "made with unity" that appears at startup
- c# - navigation setting of button does not work well in unity ui
- [unity] the gui for creating ui has disappeared
- error that reference instance does not exist when creating ui of unity
- even if the ui is displayed in unity, it will be attached once, but then disappear
- c # - i want to be able to visually understand the time it takes to hold an item for each item
- c # - slider ui is not generated from script in unity
Is it impossible to click because it is inoperable?
First, in Hierarchy of the relevant scene
EventSystem
do you have?If not right click>UI>
EventSystem
Please create with.*I'm sorry if I misunderstand the intention of the question.