Hello, AC community.
I was wondering if somebody could help or offer some guidance. To illustrate what I am trying to achieve.
When the player picks up a 'note' and adds it to their menu ( I have created a graphic that looks like a mad scrawl ) I want to be able to make it so that when the player hits 'use' or 'examine' and the UI Canvas I have created and turned into a prefab shows.
As a rough chassis to guide me, I have been following the "You have found An Item" window tutorial. However, I have got a bit lost with what I want to achieve and how to make the Events + the ActionList work as I would hope. I also will need to pair this all up correctly so... here is a bit more detail with regards to the UI/Note that fills the screen.
The Prefab / Menu item will allow the player to open and close the note as many times as they like.
As a rough guide, this is the existing logic I have used for adding 'new items' but need to tailor it to work on a note so it can be open and closed on and off. Do I need to "update content' or something else? Thanks.
p.s I should note that I have managed to get the 'New Item Window' tut to work in the end
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Is the note interactive, or just a texture?
It sounds like the Documents may be the right fit for this.
Documents don't necessarily need to have accompanying text/pages - you can define a Document in the Inventory Manager and just assign a texture. It will still be shown in a Graphic element that is set to display "Document Texture".
It's then a case of using the Document: Open Action to populate this element with the intended Document - which could be done as part of an Inventory item's Use interaction - or from an InventoryBox element set to display "Collected Documents".
The "X" Button can have its "Click type" set to "Turn Off Menu" to have it close the Menu.
Hello Chris,
Thank you for the pointers, wish I realised earlier! However, do you have any recommendations in order to change the document so that the texture displays displays correctly?
I have already made a Prefab with a custom Unity UI and managed to make it fit correctly, however. This is separate from the 'Document Menu' is it wise to customise the Document menu ( without breaking the functionality ) or is there another method?
I have attached a reference image of what is happening to my texture. It is bunching up to the lefthand side and being skewed.
https://imgur.com/a/RIuMxax
Thanks Chris
Is the Menu rendered with AC or Unity UI, and could you share a screenshot of the properties of the Graphic element that houses the Document texture?
Morning Chris. The menu in the screen grab attached is rendered the AC menu. Would it need to be tailored in some way in the Unity UI? or would a prefab need to be made?
If not, I can always double back to the method before if push comes to shove.
https://imgur.com/a/19SHRl2
It's hard to say if this is a bug or not, as it depends on the size of your screen and texture. Unity UI would not have this issue, however.
To help pin it down, open up AC's MenuGraphic script and replace the line (around 530):
with:
Does it appear correctly then?
If not, set the Size to Manual, and adjust the width/height to have it fit.
Hello Chris,
I don't think it is a bug. On closer inspection, I noticed the window that houses the texture is the size shown in image shared. I'm guessing that is fixed.
However, I think tapping into using the document menu, may not be the best way forward upon reflection. As that space on the left of the 'Document Menu' will offer to space in terms of showing the whole graphic on screen, I'm needing the graphic to be big enough on a PC computer screen so players and pick over the details. :-)
I wonder if a small bit of backtracking may be required. I have already created the note UI in Unity in scene on its own following one of your tutorials. I got it working visually as it should and converted it into a prefab. Perhaps now would be a good time to either adapt or to reverse engineer another menu item akin to what your 'new Menu Item' from you tutorial.
IF I take this route. Do you have any pointers / reminders and which bits of logic from tutorials would best suit this?
I have a graphic, with an off button in the top. It is activated by 'examining' an item in your inventory... when it is found in game.
https://imgur.com/a/MU3iZFY
https://imgur.com/a/XikeEqp
You should be able to adapt the existing DocumentUI menu to appear like your AC menu - it's just a case of moving some things around, and deleting others.
If your Document doesn't have multiple pages, you can get rid of the Shift buttons (btnShiftLeft/btnShiftRight).
You can also get rid of the Title (txtTitle).
If your Document doesn't have page text (only displays a texture), you can get rid of the Page text object (txtPage).
For the Close button (btnClose), remove the Text child, assign your "X" sprite in the Image component, and make sure the Button's "Normal" color has an Alpha value of 255. Then move it to the top-left of the Panel.
For the Document Texture, you can similarly move/resize it to suit.
In the Document menu in the Menu Manager, you can then delete the associated elements you removed (Title, PageText, ShiftLeft, ShiftRight).
Thanks Chris, cracking tips there which I have implemented this morning. Very pleased, I would be tempted to duplicate ( copy & paste ) the Document Menu and create one or two other custom Menu items in the game.
Good ideas on all the above thank you. And it looks like it still works!
One thing. My texture item, the illustration that you see in the menu, distorts the PNG graphic occassionally ( same for new item menus too ). Is there a 'clean' way of preventing this, or am I best to go and resize all of the Menu close-ups to fit? Eg, formatting all images to sit on a 700 x 700 px frame. Let me know if that makes sense.
As a guy who works with UI. I am keen to make sure this looks okay
How the Image gets resized is based on your Game window's aspect ratio, combined with the Canvas Scaler component - unless I'm misunderstanding your meaning.
If the image icons are all of a fixed aspect ratio, the Image RectTransform that displays them should be of a similar ratio.