Hello all, I'm new to this forum, I have a quick question, hope someone can help me out.
I have a horizontal black bar graphic that fades out at either end for my characters dialogue background image, and a similar one to go behind scene hotspot titles, for the sake of consistency.
For the exit of a room I change the cursor to a footsteps icon, I inserted a single space in the title text field to keep that blank, only, my empty black bar shows up too as my exit is just a regular hotspot.
Is there any way I could disable the background image for only my exit hotspots? or maybe a way I could create an alternate custom hotspot for this purpose? (exits only)
Hopefully I explained that ok, thanks in advance.
Comments
So this black bar graphic is essentially your restyled Hotspot menu? This can be done by hooking into the OnHotspotSelect custom event, which is called whenever you select a new Hotspot. You can use this to check a pre-defined List of Hotspots for which the menu should not show, and lock it / unlock it accordingly.
Try this script:
http://pasteall.org/888335/csharp
More on Custom events can be found in the Manual, as well as this tutorial.
Yes the black bar behind my text is in the hotspot menu's hotspot label background texture.
I edited my exit hotspot's action list to include Menu >Change state> Lock Menu (Hotspot)
But because it only works on a mouse click, unfortunately my empty black bar still shows on the initial mouse over.
Other than that this seems like the perfect solution thank you, as I do want to keep the black bar image on all other hotspot labels, I will keep trying
Maybe an invisible menu button in place of the exit hotspot that is set to mouseover that runs an action script? or is there a cleaner way?
Thanks again, and thanks for AC it's awesome
Edit, just looked into the invisible menu button thing, and it would need one for every exit in the game! didn't think of that
I'm sure I will look back on this first post in the future and cringe
Paste the code into a new C# script file named SelectivelyLockHotspotMenu.cs. Then add an empty GameObject to your scene, and attach the script to it by dragging it onto its Inspector.
The script has public variables in it, which means it'll have fields in its Inspector you can set - in this case, the name of the menu to lock (by default, this is "Hotspot"), as well as a list of all the Hotspots in the scene for which the menu should not turn on.
You'll have to repeat this for all scenes in your game with Hotspots like this, but try it with one first and see how you go.
That's exactly what I did when I was just guessing, but the empty black bar background still shows up, weird
Maybe my hotspot graphic is set up incorrectly? I don't think so though, I followed both your tutorial and the Callahan Curse one to the letter.
Here's a screenshot of the image background:
Which versions of AC and Unity are you using? Let's also see a screenshot of your use of the SelectivelyLockHotspotMenu component, which should be present in your scene.
Thanks again for the reply,
Here's my set up:
The component looks set up fine - try pasting this at the end of the script's SelectHotspot function:
Debug.Log ("Selected Hotspot " + hotspot.name + ", Lock menu? " + lockMenu);
Then keep the Console window open during gameplay, as it should tell you if it's locking the menu or not for each Hotspot. What does it display?
But this was breaking your script somehow, it disabled the hotspot menu on mouse over but didn't re-enable it on exit, but anyway I have fixed it by re-enabling hotspot menus as part of the inventory menu closing action list.
So it's fixed kind of
Thank you for the script!