An expansion for Guavaman's Rewired Unity Asset that provides a simple to use API for showing input icons to the player at runtime based on their input method and bindings.
- Features numerous built in components to quickly show an icon for an action
- Automatically changes sprites to show the user's most recently used device
- Can show multiple sprites inline with text using TextMeshPro sprite sheets
- A Unity project of Unity 2020.3 or later
- Ownership of the Rewired Unity asset
- Download and install the Rewired asset into your Unity project
- See Rewired's Quick Start for more information on getting started with Rewired.
- Note: The Rewired asset will never be included in this package. Purchasing Rewired from the Unity Asset Store is required for this asset to function.
- Install the package via Git in the Package Manager
- Ensure you have Git installed on your system
- In Unity go to
Window -> Package Manager
- Press the + icon at the top left of the Package Manager window
- Choose "Add package from Git URL"
- Enter the following into the field and press enter:
- Tip: You can append a version to the end of the Git URL to lock it to a specific version such as
https://github.com/Orange-Panda/Rewired-Glyphs.git#2.0.0
- Tip: You can append a version to the end of the Git URL to lock it to a specific version such as
https://github.com/Orange-Panda/Rewired-Glyphs.git
- Refer to the official Unity documentation for more info on installing packages through Git
- Import the
Kenney Default Glyphs
(Pixel Art) orXelu Default Glyphs
sample from this package in the Package Manager.- This will import CC0 licensed input sprites by Kenney or Xelu alongside
GlyphMap
andGlyphCollection
assets that associate inputs to glyphs. - By default this should import to your project at
Assets/Samples/Rewired Input Glyphs/{version}/{sample name}
- Feel free to move these files to any location you'd prefer
- If you use these glyphs in your application you are encouraged to support their creator when possible
- This will import CC0 licensed input sprites by Kenney or Xelu alongside
- Find the Rewired Input Manager prefab in your project and add the
Rewired Glyph Manager
component to it.- This component and others in the package can be found in the Add Component menu under
Rewired Glyphs
- This component and others in the package can be found in the Add Component menu under
- Add the
Glyph Collection
imported from step 3 to theRewired Glyph Manager
- Press the
Generate TMP Sprite Sheet
button on theRewired Glyph Manager
- This generates TextMeshPro sprite sheets that allow for inline input glyph icons with your text.
- You are ready to go! Check out the usage section below to start displaying the icons in your project!
There are several ways to show input glyphs in your project such as:
- Built-in components
- Custom components
- Polling the
InputGlyphs
API directly
Let's cover some of these methods and how to use them in your project.
GlyphRichTextFormatter
- Attach this component to a Game Object with aTMP_Text
and it will format text such as<glyph "Jump">
into an inline sprite that represents that action.<glyph "Jump">
will show the jump input sprite for player at index 0<glyph "Move Horizontal" 1 Negative>
will show the move left input sprite for player at index 1<glyph 13 0>
will show the action #13 input sprite for player at index 0<glyph "Move Horizontal" Full>
will show the move left or right input sprite for player at index 0
GlyphImageOutput
- Show an input icon for an action, even if there is no sprite.GlyphTextOutput
- Show an input description for an action.GlyphHybridOutput
- Show an input icon for an action or fallback to text if there is no sprite available.GlyphLabeledImageOutput
- Show an input icon with an associated but independentTMP_Text
and set their layout.
Custom components can be created by inheriting from GlyphDisplay
.
This class provides the void SetGlyph(Glyph glyph, AxisRange axisRange)
method which is automatically invoked when a glyph may have changed such as a input device changes or preferences modifications.
Most of the built-in components inherit from GlyphDisplay
so consider referencing them for examples.
If you wanted tighter control over your implementation of presenting glyphs you can also use the InputGlyphs
class to get glyph information yourself.
Some important members to consider are the following:
event Action RebuildGlyphs
- A static event which is invoked whenever the Glyph output of this class may have changed.Glyph GetCurrentGlyph(int actionID, Pole pole, out AxisRange axisRange, int playerIndex = 0)
- Get theGlyph
for particular player's action.void SetGlyphPreferences(HardwarePreference hardwarePreference, SymbolPreference symbolPreference)
- Set the preferred symbols you want to present to the user.
For more information check out the official documentation for articles and API reference.
- Use the Issues or Discussions of this GitHub repository for support.
This package is developed by Luke Mirman under the MIT License.
- Joystick icon used in the logo and icons used in component icons are provided by Google Fonts under the Appache 2.0 license.
- Lato font in the logo is provided by Google Fonts under the Open Font License.
- Project sample glyph icons included in package were created by Kenney and Xelu (respectively) and distributed under Creative Commons CC0 license.
- Some icons were altered from their original state
- DocFX Documentation template provided by Singulink under MIT license
- Guavaman for developing the Rewired asset this package supports
The development of this package is not associated with Rewired or Guavaman. Do not contact Rewired support for any issues you encounter with this package.