Assets/HotspotHighlighter.cs(40,47): error CS1061: 'Hotspot' does not contain a definition for 'GetMainIcon' and no accessible extension method 'GetMainIcon' accepting a first argument of type 'Hotspot' could be found (are you missing a using directive or an assembly reference?)
I am trying to add the hotspot main icon to an UI element on hotspot hover and it works great in play mode in editor. But when I try to build the game, I get this error. Any ideas?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Hotspot _hotspot = KickStarter.playerInteraction.GetActiveHotspot();
MenuGraphic hotspotIcon = PlayerMenus.GetElementWithName("Hotspot", "Icon") as MenuGraphic;
hotspotIcon.graphic = _hotspot.GetMainIcon();
this is the piece of the C# code.
it is run on update to be able to update the icon when deselecting inventory item on top of a hotspot. But even when using event manager for this the .GetMainIcon() throws a compile error.
this code snippet I posted is only run if the mouse is on top of a hotspot.
I was able to get over the issue with a bit of a hack:
Hotspot _hotspot = KickStarter.playerInteraction.GetActiveHotspot();
MenuGraphic hotspotIcon = PlayerMenus.GetElementWithName("Hotspot", "Icon") as MenuGraphic;
int _iconID = _hotspot.GetFirstUseIcon();
hotspotIcon.graphic = KickStarter.cursorManager.GetCursorIconFromID(_iconID);
Welcome to the community, @jussik.
GetMainIcon is a function available in the Hotspot script with the latest version of AC. Which version are you using?
I just downloaded the latest version before this problem.
it works great in editor play mode but fails on build
Thanks for the bug report - indeed, it's currently an Editor-only function.
You can remedy this by opening AC's Hotspot script and finding the GetMainIcon function around line 1789.
To fix it, move the
#endif
line underneath the function so that it's just above the function instead.Thanks! I prefer to keep the Adventure creator code unchanged, so that I do not have to keep track of what I changed when the component is updated. But my workaround works for now, but it is good to know that there is a fix for this if I need to fix it. Will you be adding a fix in a later update to AC?
Certainly - I will make the same change to the next update.
Superb! You have like the best tech support out of any product I have ever used!