Hello ChrisIce.I am making a 2D mobile game.My current Hotspot detection method setting is Player-vicinity. Players need to walk near the hotspot and manually click on it to display the interactive menu. I hope the interactive menu will automatically appear in nearby hotspots when the player moves.How do I do it.Thank you.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What are your AC and Unity versions?
I'll need to see your Settings Manager in full - can you share screenshots?
AC1.74.5,unity2021.3.46f1
https://imgur.com/a/v2nFg4b
Okay, I've hidden the settings that I thought were irrelevant. I will submit a complete image later.
To allow for this behaviour on touch-screen, attach the following script to your Player and fill in its Inspector:
This requires the latest AC update to be imported, however.
thank you,ChrisIce.This is very helpful to me. In fact, I need to display all the hotspots near the player instead of the nearest one. I tried to make modifications, and it displayed normally when there was only one hotspot near the player. When there are two or more hotspots, neither will be displayed. Is there any related setting that restricts the hiding of the Interaction menu.
`using UnityEngine;
using AC;
public class AutoShowInteractions : MonoBehaviour
{
}`
SetActiveHotspot only supports one Hotspot at a time.
It ought to be able to enable multiple interaction menus at a time by - through code - duplicating a Menu, initialising it for a given Hotspot, and turning it on. Something like:
Thank you,Chris.This seems quite complex and requires object pooling to manage all Interaction Menu. I want to change the interaction design. Instead of directly displaying the interaction menu, a unified icon is displayed on all Hotspots within the scope of Hotspot Detector. The purpose of this icon is to prompt players that there is a Hotspot where they can interact, and when this icon is clicked, the interaction menu will be displayed. I found that setting the "Display Hotspot icons" to "only when highlighting“ and then adding Highlight Component for each Hotspot can effectively implement my idea. But my game completion rate is relatively high, with a considerable number of Hotspots scattered across different scenes, resulting in a very heavy workload. Do you know any simple methods?
Thank you,Chris.I have found a solution.But I encountered a new problem. After I click the interaction menu button, the highlight icon will reappear and quickly disappear.
Does this occur as a result of any scripting? I'll need to know the solution you found.
I didn't scripting.
My solution: Set the 'Display Hotspot icons‘ to 'Only When Highlighting', and then add a highlight component for each hotspot and assigning it to the ’ object to highlight' field of the hotspot component.
Does this issue occur in the latest release? Import it into a duplicate/backup project.
Share screenshots of your updated Settings Manager and Interaction menu.
Hello Chris.I found that the problem is with the CanDisplayHotspotIcon() function in Hotpost. After clicking the interaction button, KickStarter. stateHandler IsInGameplay() did not immediately turn false. The source of InteractionUI is Unity UI Prefab. As is well known, clicking on the interaction button or clicking on other areas will close the Interaction UI. But I found that these two closing methods in PlayerMenu use the same function. My question is, is there currently a way to determine whether the interactive button or non interactive area is closed when closing Interaction UI? This is crucial for me to solve the current problem.
I'm not following the connection between the two, but you can try hooking into the OnMenuTurnOff event and checking if the mouse is over an interaction menu:
Thank you,Chris.I found the reason for the Hotspot icon flashing. There is a vacuum period of over ten frames after clicking the interaction button and before the ClickButton function in PlayerInteraction is executed. During this vacuum period, the icon was rendered.
That may have since been addressed in the latest release - you'll need to import it into a backup/duplicate project and see if the issue persists.