Hi,
I would like to ask for a possibility to change the behaviour of LMB and RMB.
Right now I show the interactions menu with "choose hotspot then interaction".
What I like to achieve is that LMB is just a "walk to" and RMB opens the interactions menu.
I tried to use the option "mouse click have diffrent behaviour" to change the InteractionsA/B. But I think thats not really the right way...
thanks for any answer!
Raul
AC:1.73.7
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @plautzus.
Rather than changing the mouse input settings, set the See interactions with field to Via Script Only. This will prevent LMB clicks from opening the Interaction menu, allowing you to make use of a simple script to instead to do the job with RMB clicks:
Paste the code into a C# file named RightClickInteraction, and add to a GameObject in the scene - that should do the trick.
thank you very much for the very quick help! it worked very well!
Hi,
maybe one little further question.
LMB doesn't execute "walk to" now. If I now click on a hotspot, the player doesn't walk. Do I have to create a script like LeftClickInteraction and define to walk to the hotspot marker? I tried to - again - using "mouse click have diffrent behaviour" and bring back the LMB functionality via active inputs.
Thank you!
It'll need similar scripting, yes, but we can combine the two clicks into the same script. Give this a try:
Thank you!
Unfortunately, I get an error:
Apologies.
Before anything else, I wanted to say that AC is so much fun to use and I appreciate so much that you giving us the opportunity to develop our games and start (and hopefully successfully finish) projects with friends and family.
The code is working now. I can launch the game but there is still no movement when clicking LMB on a hotspot.
It requires use of a Hotspot's "Walk-to Marker" to determine the Player's destination - are these assigned for the Hotspots you're testing with?
ok, that was the trick. I guess I could figure that out myself.
Thank you very much! Thats now exactly what I wanted to achieve.
Hi again,
can you tell me what to do if I want to close the menu when clicking an interaction. right now the menu closes when the interaction gets executed (e.g. player is far away from hotspot - look at hotspot - player starts walking - menu open while player is moving - "nice hotspot" (menu closed)). The behaviour should be like when leaving the menu with the cursor.
Thank you!
The Interaction menu should close when the Interaction is run - do you mean that you don't want it to close when clicking an Interaction?
If the Settings Manager option Close Interaction menus even if Interaction doesn't block gameplay? is unchecked, then the Menu will remain open if the chosen Interaction ActionList does not interrupt gameplay - i.e., if its When running property is set to Run In Background.
What I'm looking for is something like Close interactions with: on click
What I did, I changed it to "via script" and created a script:
using UnityEngine;
using AC;
public class LeftClickCloseInteractionsMenu : MonoBehaviour
{
private void Update()
{
if (Input.GetMouseButtonDown(0))
AC.KickStarter.playerMenus.CloseInteractionMenus();
}
}
and its working quite fine. Is this the right way to do it?
thx
It may need tweaking further down the road based on other aspects of your interface, but if it's working for now I'd say it looks fine.
ok, thx chris
Hi again,
the interactions menu is now working quite fine but there is always be a but...
I can't open the interactions menu with RMB in the inventory. If I change See interactions with: to Click On Hotspot again its working with LMB.
Maybe it is something missing in the script?
Thank you!
Yes - if you want to have the same thing for inventory items, it needs to be specifically included in the script:
unfourtunaly that didn't worked
In what way does it not work? Have you set your "Inventory interactions" setting to "Multiple" to enable interaction menus for Inventory items?
Best to see a screenshot of your Settings Manager as well.