Forum rules - please read before posting.

'Unity UI blocks interation and movement' does not work in only one of my scenes.

Hi,

This problem really confused me for a few days, the question is the 'Unity UI blocks interation and movement' option won't work in one of my scenes, yes, one of the specific scene, the other scenes ? works fine.. I did a lot of work on checking this scene, nothing was found.

And this problem will not show when I run the game on Unity Editor, but it will when I build an Android APK and run it on an Android device.

This is my interface settings in setting manager.

Have you guys ever met this before or got any clue ?

Regards,

Comments

  • What is the problem, exactly? Is the whole screen blocked, none of it, or the wrong portion?

    This option will affect all UI elements - not just AC Menus. Does your scene have any UI elements / EventSystem in it that isn't AC-related?

    What UI elements are normally doing the blocking, and are they present in the scene as normal? Screenshots to illustrate the problem will help to understand the context.

  • Hi,

    Thank you for responsing so quickly, I was trying to upload a screenshot in my last post, seems failed? never mind.

    The problem is in one of my scenes, Unity UI elements won't block character movement or hotspot interaction.

    http://www.roflplay.com/sample/video.mp4
    http://www.roflplay.com/sample/sc.jpg
    http://www.roflplay.com/sample/sc2.png

    I have made a video, I think this one will help us to locate the problem, In the first scene, when I tap on the inventory panel on the bottom of the screen, the character won't move nor activate any hotspots, while in the second scene, when I tap on the inventory panel, the character can move left or right, and can activate hotpots under the inventory panel.

    This only happened in the specific scene in the video, and in the other scenes ? won't happen. there is really nothing special in this scene, I've remove the cutscene of OnStart, so when the character came in, it won't do any setup special.

    And this only happened on my Android device, it won't happen in Unity editor (sorry I have not test it on iOS devices).

    The inventory panel is an AC menu, I have made a screenshot of this.

    BTW, I have even check the variable 'unityUIClicksAlwaysBlocks' in AC's SettingManager, and I've never change this one from any of scripts of myself.

    Regards,

  • Thanks for the video and screenshots.

    Open up the PlayerMovement and PlayerInteraction scripts. In both, there'll be a function named "UnityUIBlocksClick".

    In each of these, test removing the first instance of "return false;" - this'll be greyed out in the Editor because it'll only be run in builds.

    Does that solve the issue?

    I was trying to upload a screenshot in my last post, seems failed?

    For security, uploading to this site isn't allowed - but you can upload to e.g. imgur.com and paste links.

  • edited October 2020

    Thanks for the help.

    I tried to comment ' return false', like this:

            protected virtual bool UnityUIBlocksClick ()
            {
                if (KickStarter.settingsManager.unityUIClicksAlwaysBlocks)
                {
                    #if !UNITY_EDITOR
                    if (KickStarter.settingsManager.inputMethod == InputMethod.TouchScreen)
                    {
                        if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
                        {
                            if (KickStarter.playerMenus.EventSystem.IsPointerOverGameObject(Input.GetTouch(0).fingerId))
                            {
                                return true;
                            }
                        }
                        // return false;
                    }
                    #endif
    
                    if (KickStarter.settingsManager.inputMethod == InputMethod.TouchScreen ||
                        KickStarter.settingsManager.movementMethod == MovementMethod.PointAndClick || 
                        KickStarter.settingsManager.movementMethod == MovementMethod.StraightToCursor || 
                        KickStarter.settingsManager.movementMethod == MovementMethod.Drag)
                    {
                        return KickStarter.playerMenus.EventSystem.IsPointerOverGameObject ();
                    }
                }
                return false;
            }
    

    Unfortunately, this does not solve the issue, I'm still using the input method of 'Mouse And Keyboard', although I'm building an Android build. so remove 'return false' won't change anything. For now, 'Mouse And Keyboard' works fine for me on mobile devices.

    It's really wired, UI Block works fine in almost all scenes, except that only scene, I'm trying to rebuild that scene to see would the issue disappear.

  • For what it's worth, does the issue go away if you set your Input method to Touch Screen and re-add the removed line?

    Could it be that you have an EventSystem object in your scene file? Seems like you'd get such an issue if the "playerMenus.EventSystem" was pointing to the wrong object.

  • WOW, you are a genius, Chris!

    It does not matter if the input method is Touch Screen, nor the 'return false' script line.
    I think I made a EventSystem object in the scene by accident, MY BAD :(.
    Now the issue is gone when I remove the object.

    Thank you so much....

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.