Proximity-based Interaction menus

This script causes an Interaction menu to open automatically for the Hotspot closest to the Player. Note that this requires AC v1.60.5 or newer.

First, set up your game to use proximity-based Hotspot detection (see this tutorial).

In your Settings Manager, set the following Interaction settings:
 * Movement method -> Direct
 * Interaction method -> Choose Hotspot Then Interaction
 * Select Interactions by -> Clicking Menu
 * See Interactions with -> Via Script Only
 * Close Interactions With -> Via Script Only

Then create a new C# script named InteractionOnNearest: using UnityEngine; using AC; public class InteractionOnNearest : MonoBehaviour { 	public float minimumSqrDistance = 10f; private void Update { 		// Check if there is a player with a hotspot detector if (KickStarter.player != null && KickStarter.player.hotspotDetector != null) { 			// Read the nearest Hotspot to the detector Hotspot nearestHotspot = KickStarter.player.hotspotDetector.NearestHotspot; if (nearestHotspot != null && KickStarter.stateHandler.IsInGameplay && (nearestHotspot.transform.position - KickStarter.player.hotspotDetector.transform.position).sqrMagnitude < minimumSqrDistance) { 				// If there is a Hotspot nearby, and it's during gameplay, show Interaction menus for that Hotspot KickStarter.playerMenus.EnableInteractionMenus (nearestHotspot); } 			else { 				// Otherwise, close Interaction menus KickStarter.playerMenus.CloseInteractionMenus ; } 		}  	}  }

Attach this either to an object in your scene, or to your Player prefab. Interaction menus will now turn on automatically for the Hotspot within the detector that is nearest the player.