I’m here again with this problem because I think that either I didn’t explain my problem right or maybe it got misunderstood. The issue is simple, if the action button (containing a skill) is over an NPC (or other object), if I click on the button, the NPC under/behind the button also gets clicked, and then the skill gets executed/activated. I don’t want the NPC to get selected (clicked)!
So here I go with the long explanation of the problem using a stripped-down project.
I opened a topic some time ago with pretty much the same tittle and I abandoned my efforts to fix it at that time because I thought I could “live with it”. But really, at this point it kills the fun and my patience and nobody can have a fluid gaming experience with that issue. Considering I’m not a programmer (That’s why I bought plyGame), I’ve followed videos that suggested me how to fix it, but nothing good from it. I’ve tried to implement some “short scripts” that have posted, but still, the basic concept is missing and not working. Then I come across my old post again and some other similar posts, where some answers simply state that if I’m using the sample/included UI (rpg_ui), I don’t have to do anything more to make it work, but I’m indeed using the sample UI and it is still not working. I’ve deleted and added again and again the script to the Execution order and still doesn’t work. Sorry if I’m bursting with words here but this issue is converting me in a “grumpy guy” cuz based on the other topics I shouldn’t be dealing with this issue.
I’ve stripped the project of all my stuff just to get to the bare core/basics of it and it’s simply annoying to note that the “order” of things happen exactly the other way around. I mean, I added debug notes to the different events, and the first thing that gets executed is the event from the object that was clicked thru… and then the event of the GUI button… Is my project cursed or something? If there was a simple way to copy/transfer all the prefabs (with the plybox stuff added), plus the spells, items, quests, etc., I would have started a project from zero to see if that works. But there’s no way to transfer that stuff, or is there a way?
Well, if you’re still reading at this point, maybe you want to help me out. I decided to create a blank project, and I only added plygame as package/assets to identify if my stuff was the one causing the problem or something else (Isolating the problem), followed the steps and got the problem again… why?
Here’s what I did:
1 - Created a new project and added plyGame
2 - Initialized plygame (it happens the first time you click this button)
3 - I configured a class and two attributes for that class (health,experience)
4 - I added a test skill (with only the event “On skill active” working, just a debug note to know it was activated)
5 - I Created a scene.
6 - Added a plane. Added an Sphere (as my Player). Added the player controllers, camera, actor, etc.(I can move the sphere with keyboard and mouse clicks) and I assigned the test skill to the player, slot 1 (or index 0)
7 - Added the sample_ui.unitypackage
8 - Added the two scenes (my main scene and the rpg_ui) to the plyGame project settings:
9 - I also added those to the Build settings (I made sure they were there already):
10 - I added a cube to the scene, to act as my NPC. I added a plybox and an event “On mouse down” with a debug note to it:
11 - I went to the rpg_ui to add an event to it, to have a debug note when it was clicked (even when we are gonna know it was clicked because the Skill was activated).
12 - I also made the button bigger and the whole area:
13 - And at last, I went to look at the Script Execution order to see what was there, and it was configured “the right way” as I’ve been reading in other posts:
So, it is time to test this “basic” scene to see what gets clicked first, and he’s an screenshot of the result:
And I click on the button/skill and this is the order:
What I was expecting is:
GUI button gets clicked
Skill gets activated… and that’s it! but no… the NPC got clicked too… why???
I also made a short video of it, showing that the player (the sphere) moves with the click-to-move, so:
- If the button is NOT over an NPC, the skill gets activated when the button is clicked and the “click-to-move” is not performed, and that’s good.
- But if the button is over an NPC, the NPC “receives” the click and then the button gets the click and the skill gets activated…
Sorry for the level of frustration shown in this post, but my patience ran out.
Anyway, I hope somebody can give me an idea on how to fix it and preferable something already applied as a solution and not just a vague direction cuz most likely I’ll get lost along the way.