Hi. I’m having problem with this simple script:
what I expected:
When I get into the BP radius it has to enable player input
When I leave the BP radius it has to disable player input
When I’m in radius, so the input is enabled, and i touch the red sprite (or i click it with the mouse now that i’m on pc), the sprite has to disappear.
What I got:
Actually, even if the input enable/disable are triggered, the touch or click event never start. The “E pressed” event, instead, works.
Second question: as you can see I use a branch and a tag to check if the player is overlapping an actor. Since it’s a mobile game, if you know any better method to check this, please tell me
Your collision is set to overlap, set it to custom and check all that applies, but make sure you check block on visibility.
Let’s see… I was already trying something in collision options but I didn’t make it work. I’m sorry I’m really newbie in touch interface stuff
Here is how i set the collision of the PaperSprite, which is also the root of the class BP
Ok, I haven’t been in 2d much, at all really, but I found the issue. In the Paper2d clickable events are disabled by default. In the GameMode or in the level blueprint you can set “Enable Click Events” to true on event begin play or something like that.
Let me know if this works for you!
oooh, I see now. Thank you! I’ll try it now!
If you are going to be using touch events, you don’t need to turn on clickable events. Just go into your project settings, Under Engine, then Input, and check the box that says “Use Mouse For Touch.”
Yes, i’m gonna use touch event. but for debug purpouse i have to use mouse too
Yeah. I checked it out earlier and even with click events disabled, you can still use touch events with the mouse as long as you have the use mouse for touch events. checked.
I set the stuff as recomended, but still no touch or click event works.
E key still working. Mouse cursor correcly showing.
Here’re the collision settings of the sprite
So, you need to find the cause. I think it may be your overlap event. Allow the player to tap on it whenever and see if it works. If it does then add the overlap. However, I would not do it the way you have it. On overlap, I would set a bool variable that in the actor. then when I click, if the bool is true it removes it. If not, nothing happens. So on overlap with player, not with tag, I don’t like that. If overlap actor == player set it to true then when he leave, set to false. look at the image below. that is all it takes.
I have click events disabled, but I have set use mouse for touch events enabled in the inputs and it works for me in the 2D map. No issues.