Hi @ChrisIceBox
Sorry to ask too many questions. Need help again.
Video of the problem: https://streamable.com/dc0r0v
Hot spots occasionally overlap with the joystick and hot spot interaction comes into play. To deal with this problem, I tried to make a button that appears on the screen when the player approaches the hot spot. So hot spots will only work when the hot spot interaction button is pressed. But I couldn't do it exactly.
I encountered a topic like this in the forum : https://adventurecreator.org/forum/discussion/7440/hotspot-use-button-on-gui
The codes you wrote have been deleted by the site:
Link: https://pasteall.org/938123/csharp
Can you help me?
Thanks in advance...
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I don't have the old script to hand, but this should do it:
Set your Interaction method to Custom Script, and make a Unity UI to store the "use" Button. Don't link this to AC, but instead attach the script above to the Canvas root, and assign the Button field in it's Inspector. Then set the Button's OnClick event to this component's "UseInteraction" function.
The Button should then show/hide automatically when a Hotspot is in the centre of the screen, and clicking/tapping it should then run the interaction.
Hi @ChrisIceBox
I did everything you said. But I got an error in the codes.
Picture One: https://imgur.com/EZatZII
I solved the error I received with the suggestion of visual studio.
Picture Two: https://imgur.com/72NOHyM
But the code doesn't work.
Picture Three: https://imgur.com/l8Oa2dA
Picture Four: https://imgur.com/I6Yzi44
Picture Five: https://imgur.com/ny19UO8
In the OnClick event box, you need to first drag in the Canvas root (where the component is), and then find the component in its hierarchy - not assign the script file itself.
Sorry it didn't work again.
Picture 1: https://imgur.com/u8OYLdc
2: https://imgur.com/rBHffpJ
3: https://imgur.com/bPO8JzD
4: https://imgur.com/KBKa9C1
5: https://imgur.com/H3HzJrm
6: https://imgur.com/90laaw2
Original Scripts: https://imgur.com/xU6wFXm
Modified Scripts: https://imgur.com/LZ4ENnr
Sorry, it's my fault.
Aside from the Button conflict, it was also disabling the root canvas - not the Button itself.
I've updated the post above with the corrected code - give it a try now.
Continues to fail
Video: https://streamable.com/4ocn70
Apologies again - I think I removed something when editing last time.
Updated once more. The "Hotspot detection method" will need to be kept as "Custom Script" as well, but this is working on my end.
Works great except for a minor problem.
The "use" button does not disappear after moving away from the hot spot. He works once again while away from the hot spot.
Video: https://streamable.com/n0xlp4
Also, when we turn our back to the hot spot, the "use" button does not disappear.
Video 2: https://streamable.com/q2mxzm
Sorry for bothering you...
It's no bother. Try this:
It works very well. I am grateful to you for your help @ChrisIceBox