Hello, I was thinking about putting a notebook in my game. When you got close to the Hotspot and pressed the key for a few seconds, it would say that the character was writing and the image of the notebook would appear.
Do you have any idea how I could do this?
Sorry for any wrong words, English is not my native language
Comments
Welcome to the community, @sonicgames728.
I'll need a few more details about the way your game is played. Are you looking to have this occur for all Hotspots, or just one / some? What is the result of the character writing in the notebook?
Is this a 2D or 3D game, what how are Hotspots normally interacted with? If you can share screenshots of your game and the Hotspot in question, it'll help understand the situtation.
AC can detect inputs with the Active Inputs window. Though, if you want to involve holding a key down for a few seconds - as well as only when the Player is near a given Hotspot - you're likely better off handling this with a custom script.
This'll likely need tweaking to suit your game, but this script (HotspotInputTimer.cs) will run an ActionList while a given Hotspot is selected, and the given key has been held down for a set time. Attach to the Hotspot and fill in it's Inspector fields:
Thanks for the details - ignore my script above, I was misunderstanding.
This'll be a little bit involved, so we'll need to take things step by step.
What you can do here is rely on a Document to store the notebook's pages. In the Inventrory Manager, click the Documents tab and create a new Document. For each photo, create a new Page, and assign the photo as that Page's Texture.
You'll then need a Menu that is able to display the Documents. If you're using AC's default interface, you should already have a Document menu in your Menu Manager.
The default Document only displays the Texture of the Document itself. You can change this, however, by selecting the Texture element in the Document menu, and then - in its Properties panel beneath - setting the Graphic type to Page Texture, and then Journal element name below to PageText.
Leave the rest as it is for now - we'll come back to the styling once the functionality is working.
To view the Document when interacting with the Notebook, create a Use Interaction for the Notebook's Hotspot, and then assign it a Document: Open Action. Make sure that the Document you've created is assigned - and you should then find that interacting with the Notebook brings up the Document menu, showing the photos you've assigned.
To have the "E" key run interactions, go to Unity's Input Manager and define an input named InteractionA and set its Positive button to e.
Do you want the left/right arrow keys to be used to flip between pages? If so, that'll be the next step - but try the above and let's take things from there.
If you want to be able to flip between the pages, showing different images, then you'll need to use a Menu so that it's content can be dynamic.
You can re-style the Menu, however, to remove the borders / text etc by editing the Menu's properties. You can remove the title, for example, by removing the TitleLabel element.
The PageText element will need to remain, but you can hide it by unchecking its Is visible? property. You can then adjust the Size property of the Texture element so that it spans the fulll width of the Menu.