First, install Adventure Creator following its instructions.
Instructions on using this package
- Install the package
com.nicegamehints.unity.ac through the Package Manager
- Create an empty GameObject that will control the hints, name it "NGHHintController".
- Attach the NGHMenu component to the GameObject
- Select the Mode from the NGHMenu Inspector
- "Adventure Creator Menu" uses the menus from the AC Menu manager, supports also prefab menus
- "Adventure Creator Generic" lets you create custom
UnityEngine.UI based menus that do not use Adventure Creator menu manager
- Adjust the script execution order
- Go to Edit > Project Settings > Script Execution Order
- Add NGHMenu to the list and load it before Default time
Instructions on using the Adventure Creator Menu mode
In-game hints need two menu views: Guides view and Hints view.
In the Guides view are listed all the active guides at the moment. The user can click one of the guides to see hints regarding that guide. In the Hints view the selected guide is shown as a series of gradual hints. There should be a "Next hint" button to navigate to the next hint in the guide.
First, Attach the AC Menu Manager to the NGHMenu component.
The Guides view
- Create a prefab menu Canvas. Name it "GuidesMenu". The Canvas should include at least the following UI items:
- Another Canvas that has a Vertical Layout Group component
- Inside that Canvas, a Button. This button will be the sample button that will be cloned when listing the active guides.
- Create a menu in AC Menu manager. Name it "NGHGuides" and select "Unity Ui Prefab" as the source
- Add a button named GuideButton inside the NGHGuides menu.
- Click type is "Crossfade"
- Menu to switch to: "NGHHints" (this will be created next)
- Attach the prefab to the NGHGuides menu
- Drag the GuidesMenu prefab from Assets to Linked Canvas prefab
- Drag the button from the prefab to GuideButton Linked button
You should be now able to see the menu in the game. You still need to show the menu somehow. The easiest (for testing) is to have it "Enabled on start".
The Hints view
- Create a prefab Canvas. Name it "HintsMenu". The Canvas should include at least following UI items:
- A text (legacy) element (as of Adventure Creator 1.79.2 you cannot link TMP text to a Menu Label?) that will show the text content of the hint.
- A button (no need to be legacy) that will show the user the next hint. Will be automatically hidden when there are no more hints.
- Optional: A text (legacy) showing the current guide title
- Optional: A RawImage showing an image if the current hint has one
- Create a menu in AC Menu Manager. Name it "NGHHints" and select "Unity Ui Prefab" as the source
- Add a label named "HintContentText" inside the NGHHints menu
- Add a button named "NextHintButton" inside the NGHHints menu
- On Click type select Custom Script
- Attach the prefab to the NGHGuides menu
- Drag the HintsMenu prefab from Assets to Linked Canvas prefab
- Drag the text from the prefab to HintContentText Linked Text
- Drag the button from the prefab to the NextHintButton Linked button
- Optional: Add a label named "GuideTitle" inside the NGHHints menu
- Drag the corresponding text from the prefab to the Linked Text
- Optional: Add a graphic named "HintContentImage" inside the NGHHints menu
- Select UI image type to "Raw Image"
- Drag the corresponding raw image from the prefab to the Linked Raw Image
You should be now able to click the guide button (set is visible in AC Menu Manager) in the Guides view and it should show you the HintsMenu prefab with default values.
You might want to implement close buttons to each menu but that is outside the scope of this guide.
Attaching the actual hints to the NGHMenu
- Create a folder named "ngh" inside Assets
- Create a new file named "sample.md" inside the ngh folder
- Add following content inside the sample.md file
title: A sample guide
This is the first hint
This is the second hint
- In NGHMenu component, fill the Hints path with "Assets/ngh/"
If you now open the Guides view, you should see a button with text "A sample guide". You might also see the default guide. You can set it non visible in the AC Menu Manager. When you click the "A sample guide" button you should see the Hints view. It will show you text "This is the first hint". When you click the next hint button you should see text "This is the second hint" and the next hint button becomes invisible.