Hello!
I've working on a map but instead of using the Menus (buttons) I tried to use the Hotspots so I could trigger action lists and make good use of all the things the hotspots have. I searched the forum for a solution and found something like this:
using UnityEngine;
using AC;
public class MouseOverHotspot : MonoBehaviour
{
public ActionList onHover;
private void OnEnable()
{
EventManager.OnHotspotSelect += Hover;
}
private void OnDisable()
{
EventManager.OnHotspotSelect -= Hover;
}
private void Hover(Hotspot hotspot)
{
onHover.Interact();
}
}
To test it out simple, I created some sort of glow over the sprite (another sprite which turns visible). Unfortunately it only works on one hotspot disregarding which hotspot I'm hovering over.
I also created a second Action list so when it goes away from the hover, to run another action list to restore everything to normal. Practically same approach but in two different scripts.
Unfortunately, not even making one or two scripts for hotspots I could make it work.
The simple question is: how can I trigger an action list when hovering over a hotspot? And maybe another one when hovering away? If it's possible... of course.
By the way: I did look into the tutorial but we wanted to go a step further.
Thanks.
Latest AC. Unity 2020.3.38
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
If you want to have the "onHover" ActionList run for a specific Hotspot, you need to compare the function parameter with some value. If the script is attached to the Hotspot itself, for example, you can compare its gameObject:
THANKS! Exactly what I was looking for. Thanks again for everything!
I have the same question. And i am a null knowledge beginner in looking at C# codes, finding them intersting though my experience with AC.
Unity 2020.3.30f1
AC 1.78.4
I did not want this ability for AC Hotspots but for some Unity GameObjects with colider which can run actionlist onMoveEnter and OnMouseExit
With lots of search and tutorials i managed to have this script:
I think i am wrong with using KickStarter.
Maybe i must use AC.AdvGame.Interact ?????
and i was Hoping i can use RememberAnimator Component on them to keep track of their condition when scene changes or loads.
See the Manual's "Interaction scripting" chapter for details on how to run an ActionList through code.
In short, you just need to call its Interact function: