I am creating my first game with the help of Adventure Creator, and I am already looking for a certain special feature:
Inspired by games like Chains of Satinav and Anna's Quest (both created with Visionaire), I would love to have some button in the HUD (UI overlay) which can be clicked and then be "applied" to any hotspot in the scene or inventory - without this special custom action being available (visible) via the standard interaction menu. Imagine for example a brush with color that can be applied to different items in the scene. Or a "Special Ability" (like Telekinesis or a spell that can destroy or repair stuff - as seen in the mentioned game references).
I am currently using "choose hotspot then interaction" option for the default interactions, but imagine this to be different.
I am using Unity UI (with Unity 2022.3.19f1 and the current AC version 1.81.6, my project is a 2D game).
I managed to add a custom action (which only worked after switching back to AC UI and then back to Unity UI, otherwise it had the same effect like the action I had duplicated). But this is not really what I want.
This special action would need to be always visible (besides during cutscenes/dialogues).
I'm thinking along the line of making the custom interaction available on a hotspot, but not having it visible in the interaction menu. I have an idea how I could do this (via manipulating it in the Unity UI, even if it feels like dirty trick). But I'm not sure if I can control that interaction with an "external" interaction button from another UI which isn't the interaction menu?
Unfortunately I have no idea how I could realize this. Somehow it feels like I want to combine different interaction methods. Is this even possible?
I am no programmer, but if there's an easy "out of the box" method to do this with or without a script I would be really happy if you could help me out.
I think this could be also interesting for other devs using AC.
I hope my description wasn't too complicated. Maybe someone else even asked this before, but I wasn't sure what to search for.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Something to add: Maybe it could also work with some kind of item combination action?
What I tried yesterday was adding a simple button in the UI and attach an interaction to it, controlled by the default unity script. This way I was able to start the interaction with only one hotspot. And it happened instantly. But what I need is "click this special interaction" and then select a hotspot I want to interact with.
So it actually sounds a bit like an item combination, doesn't it?
Welcome to the community, @Hexenwerk.
If your normal method of interaction is Choose Hotspot Then Interaction, then yes - you'll want to rely on item combinations (i.e. the Inventory system) for this. When an item is selected, it can then be used on a Hotspot or another item.
If you go to the Inventory Manager's Categories tab, create a couple of new Categories (one called Default, another called e.g. Special Ability). Your existing items will be placed in the first (Default) category automatically.
Then, create a new Inventory item (e.g. Telekinesis) and place it in the Special Ability category.
Placing items in different categories means you can then filter them in your Menus. If you now go to the Menu Manager, and select your Inventory menu, you can check Filter by category? so that it only lists items in your Default category.
Similarly, you can display your Telekinesis item in a separate InventoryBox element that's set to display only Special Ability items.
You can now define interactions for the Telekinesis item in Hotspots and other Inventory items to dictate what happens when the user clicks on the ability, and then another object.
Thank you very much for your reply, Chris! I'll try this.
Thanks again for the guide. I found the filter via "Limit by Category, under Menu > Inventory > Items"
It seems to work as expected with AC UI, but with Unity UI I unfortunately still have some problems:
1) When I click on the item and then on the hotspot (I can see the item image next to my cursor), combining the item with the hotspot doesn't start the interaction.
2) This Inventory box I've put in the bottom right corner seems to block the whole screen instead of just the area of the inventory item for the click interaction.
With this UI element, I can only interact with the inventory (it shows up when I move the cursor to the top of the screen) and open the menu.
So it looks like it "only" blocks everything behind the UI layer. But of course like this, it prevents playing the game.
Maybe you have an idea what I did wrong here?
1) I created this inventory box by copying & pasting the original inventory menu.
2) I also copied the inventory prefab UI (Unity).
3) On my first try I deleted everything I didn't need from that copy (the grid layout game object, the additional slot buttons) positioned the single item box in the bottom right corner and assigned everything.
4) On my second try I just left the copied inventory ui prefab layout as it is.
5) I assigned the button for the item as well as the canvas and the transform in the Special Ability Inventory menu.
6) With both versions of the Inventory Box Menu, I cannot start the "combine special ability with hotspot" interaction unless I switch the UI source from Unity UI to Adventure Creator. There it instantly works as expected.
7) Switching back to Unity UI, the item icon just disappears on click on the hotspot and blocks everything (it already blocks before clicking on that special item in the inventory box).
8) Even when I disable the whole Special Ability UI object during runtime via the inspector, it still blocks the game (?)
The appear type is set to "During Gameplay", the Position Type to "Manual". Both seem to work fine.
I made a screenshot of the Unity UI settings, but since I didn't change anything there, I'm not sure if there's a problem:
https://imgur.com/a/h1Ohr12
It could be down to the duplicated Menu's RectTransform boundary.
In the case of the Inventory menu (and any duplicate you've made that hasn't had this changed), this is the Panel child object under the Canvas root.
When using Unity UI menus, the "RectTransform boundary" is used to determine whether the cursor is over the menu or not - to prevent clicks reaching Hotspots and other objects in the scene. You generally want to make sure that this boundary matches the visible boundary of the UI - is this the case?
There's also a little more to it with default InventoryUI Canvas - the Auto-correct UI dimensions component is also attached to keep its position aligned with the top edge of the screen, while accounting for an enforced aspect ratio. I'd recommend removing this for the moment in your own SpellsUI.
Either way, try looking for the EventSystem object in your Hierarchy at runtime. If you view the bottom of its Inspsector, it should report what the "active" object is, which should be blank when not visibly over any menu.
You're welcome to PM me your SpellsUI prefab along with your Managers - I can see if I can spot the issue.
I tried both (removing Auto-correct UI dimensions as well as checking the rect transform boundary size). But this wasn't the problem here.
Chris helped me and found out that I had just mapped the RectTransform boundary to the wrong game object: Canvas root instead of the actual UI Panel. So it filled/occupied - and blocked - the whole screen instead of just the area of the panel. This happened because I had just dragged the Prefab into the according slot in the Menu manager.
Instead I should have opened the prefab and drag the correct object (the panel with its own rect transform) to the manager slot.
Now everything works as expected and I can continue working with the Unity UI prefab. It was a human, not a technical problem.
I'm sorry for bugging you with such a small issue, but maybe someone else wants to try someone similar and makes the same mistakes as me. So I leave the solution that worked for me here.
The issue is resolved.