Hi Chris, after updating to the latest AC, I've noticed that my flash SmallHotspotLabels are now all clumped together rather than placed where the actul hotspot should be. Please see video and screenshots here:
https://www.dropbox.com/scl/fo/gdzhg7naku2zax6tntum0/h?rlkey=muzdtsv8k0xzlrvu93wuy3brb&dl=0
And my flashhotspots code below:
using UnityEngine;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace AC
{
[System.Serializable]
public class ActionFlashHotSpots : Action
{
public float flashDuration = 1.5f;
public string menuName = "SmallHotspotLabels"; // The name of the Hotspot Menu to copy
public string labelName = "HotspotSmallLabel"; // The Label element of the Hotspot Menu
private List<Menu> localMenus;
public override ActionCategory Category { get { return ActionCategory.Custom; }}
public override string Title { get { return "FlashHotspot"; }}
public override float Run ()
{
if (!isRunning)
{
localMenus = new List<Menu> ();
Hotspot[] hotspots = FindObjectsOfType (typeof (Hotspot)) as Hotspot[];
foreach (Hotspot hotspot in hotspots)
{
if (hotspot.enabled && hotspot.IsOn () && hotspot.PlayerIsWithinBoundary () && hotspot.highlight && hotspot != KickStarter.playerInteraction.GetActiveHotspot () && (KickStarter.settingsManager.hotspotDetection == HotspotDetection.MouseOver || KickStarter.player.hotspotDetector.IsHotspotInTrigger (hotspot)))
{
hotspot.Flash ();
ShowForHotspot (hotspot);
}
}
isRunning = true;
return flashDuration;
}
foreach (Menu menu in localMenus)
{
menu.TurnOff ();
KickStarter.playerMenus.UnregisterCustomMenu (menu, false);
}
isRunning = false;
return 0f;
}
private void ShowForHotspot (Hotspot hotspot)
{
Menu menuToCopy = PlayerMenus.GetMenuWithName (menuName);
if (menuToCopy == null)
{
ACDebug.LogWarning ("Cannot find menu with name '" + menuName + "'", this);
return;
}
Menu myMenu = ScriptableObject.CreateInstance<Menu> ();
myMenu.CreateDuplicate (menuToCopy); // Copy from the default Menu
myMenu.appearType = AppearType.Manual; // Set it to Manual so that we can control it easily
myMenu.isLocked = false; // Unlock it so that the default can remain locked if necessary
myMenu.title += this.name;
myMenu.SetHotspot (hotspot, null); // Link it to the Hotspot
if (!string.IsNullOrEmpty (labelName))
{
(myMenu.GetElementWithName (labelName) as MenuLabel).labelType = AC_LabelType.Normal;
(myMenu.GetElementWithName (labelName) as MenuLabel).label = hotspot.GetName (Options.GetLanguage ());
}
myMenu.TurnOn ();
KickStarter.playerMenus.RegisterCustomMenu (myMenu, true);
localMenus.Add (myMenu);
}
#if UNITY_EDITOR
public override void ShowGUI ()
{
menuName = EditorGUILayout.TextField ("Menu name:", menuName);
labelName = EditorGUILayout.TextField ("Label name:", labelName);
}
#endif
}
}
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
What version were you updating from?
I cannot remember. I only tried the flash hotspots recently, a good while after updating, and they were clumped together. I an on Version 1.79.3, UNity 2021.3.15f1
Replace:
with:
Hi, I have noticed that when I am flashing the hotspots (using tab input) and move the cursor, the words group together. See video:
https://www.dropbox.com/scl/fi/lmybgl8v68kqrark8m2du/Tab-Grouping-Words.mkv?rlkey=b7xawfnpy05nh3s0n8ppwrmf3&st=lpk4qcgc&dl=0
Is there anyway to keep them still for the period of flashing please?
This thread is a year old, now. I'll need updated information:
Hi,
AC 180.5
This is the updated script for keeping hotspots on screen until the input key is depressed:
Menu properties here:
https://www.dropbox.com/scl/fo/u3uv79sh91p7ayitr9yc3/AEVXzDq6dVgN0nnqFhrWKNg?rlkey=3s2zkbfnidg7pv3apr4924qte&st=qh36avhi&dl=0
Thanks
Underneath:
Try adding:
getting this error
Assets/Sleepytime Village/Scripts/CustomActions/ActionHoldToFlashHotspots.cs(94,26): error CS0103: The name 'PositionType' does not exist in the current context
Thanks for that, but unfortunately they still clump together
So to reiterate, whilst the input key is held down to flash the hotspots (they stay on screen until you release the input key) and if you simultaneously move the cursor, the hotspots all clump together in the same position.
Remove the change above, instead set the Menu's Position type to Manual, and add this to the bottom of ShowForHotspot:
If your scenes support scrolling, add this to to the while loop of FlashHotspotsCoroutine so that their positions remain updated:
Tried this, as below, but still happening:
Put:
At the very bottom.
Hi Chris, the hotspots just appear in the middle of the screen and not over the hotspot if i put Menu's Position type to Manual. And if not then it still doesn't work.
The full script:
Screenshot of my menu:
https://www.dropbox.com/scl/fi/ci1in7ciyklhjt7zho88y/Screenshot-2025-01-19-at-11.34.50.png?rlkey=47rsmmndrfa71flabmbussgzz&st=0gd9947t&dl=0
my bad, works a treat!!
I've noticed that these do not fade in and out, unlike when I hover in game. Can you help me amend the script so they do? thanks
You'll need to register them before turning on, and unregister them only once they're completely faded out.
I;m now actually using UnityUI for my hotspots but they do not turn off/fade out when the flashhotsposts input is released, any ideas? (sames menu and element names) thanks
Fading in UI requires a Canvas Group component on the root.