Monarch non-top screens taking input

I am facing an issue with monarch, that the screen which is not on top of the stack is also taking input,

all screens are added using the collection factory, I have main menu and other screens are added from the main menu, but along with the new screen added the main menu is also taking input though it’s not visible. (not on top of the stack)

I have not enabled "Screen Keeps Input Focus When Below Popup" and tried by adding acquire_input_focus and without adding acquire_input_focus in code. (as it’s acquired by the monarch by default).
I’m not sure whats the problem, am I missing something?

Do you have multiple collection factories with Monarch screens on a single game object?

Can you package this into a small sample project and share it in a GitHub issue in the Monarch repo?

I have a different game object for every collection factory (screen),

Sorry, I don’t have permission to share this project, can I debug any specific direction for this?

I understand, but can you reproduce the problem in a new sample project?

Start by scaling things down. How many screens do you have loaded? You can use monarch.dump_stack() to see the screens in the stack. What if you only load the top two? Same problem?

Are you manually calling acquire_input_focus somewhere?

Hello @britzl

I have created a sample project with a similar structure where I am getting the same issue
(issue: main-menu taking input events even though its behind other screen)

Please find the GitHub link below.
also, in the example, I am facing a wired issue where the text of the main-menu component is visible on other screens too. what may be the reason for this?

while debugging I realised that local function acquire_input(screen) is called whenever I show any screen, however local function release_input(screen, next_screen) is not called for any menu (main-menu in my case) when I show another screen on top of it. Isn’t it require to release input?

1 Like

Ok, so the problem is that the menu isn’t part of the stack of screens. You load it with the no_stack option set to true:

This means that when you load any of the screens from the menu the screens will be added to an empty stack. And no input will be released on the screen below.

1 Like

Hi @britzl ,

removing no_stack= true is working as expected, but my requirement is a bit different I don’t want to go back to the main menu with a back keypress (spacebar in my case) so I intentionally added no_stack=true for the main menu. (same for splash screen)

is there any way I can clear it? because when I try to hide the main menu intentionally when going to a new screen, it gives an oblivious glitch. as the current screen is hidden before showing the new screen.

I have added hud as a quick menu to navigate to other screens without going back to the main menu. also on each screen opened from hud, I have some subscreen which can be backed by back button (spacebar in my case)

however, when I open any screen from hud I wanted to clear all previous navigation of opened screen so It can be considered a freshly opened screen from hud, is there any way to clear stack for this? and also
to avoid a glitch do I need to clear it after time interval?

I have updated Github sample project with new screen navigation, can you please have a look and suggest changes?


No, there is no function for this. You would have to repeatedly do monarch.back() until monarch.is_top(hud) is true. In this case it would be quite convenient to have a monarch.back_to(screen_id) to do this for you.

for my requirement, how can I avoid going back to specific screens (for example splash screen, main menu screen) without adding no_stack=true?

I am trying to pop the screens using monarch.back_to(screen_id)

This function doesn’t exist. I meant that such a function would be useful. Not that it already exists :slight_smile:

If you need the function then either implement it yourself and submit a PR or open a Feature Request ticket on GitHub

ah Okay, I though its already there,

Thanks I will do that,