872 lines
54 KiB
HTML
872 lines
54 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/BasicTemplate.dwt" codeOutsideHTMLIsLocked="false" -->
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<!-- InstanceBeginEditable name="doctitle" -->
|
|
<title>Rewired Documentation | Glyphs</title>
|
|
<!-- InstanceEndEditable -->
|
|
<!-- InstanceParam name="isRoot" type="boolean" value="false" -->
|
|
<!-- InstanceParam name="wide" type="boolean" value="false" -->
|
|
<link href="files/css/styles.css" rel="stylesheet" type="text/css" />
|
|
<!-- Favicons -->
|
|
<link rel="icon" type="image/x-icon" href="/projects/rewired/files/images/favicon.ico?v=1" />
|
|
<!-- Apple Icons -->
|
|
<!-- For iPad with high-resolution Retina display running iOS = 7: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="files/images/favicon_152x152.png?v=1">
|
|
<!-- For iPad with high-resolution Retina display running iOS = 6: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="files/images/favicon_144x144.png?v=1">
|
|
<!-- For iPhone with high-resolution Retina display running iOS = 7: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="120x120" href="files/images/favicon_120x120.png?v=1">
|
|
<!-- For iPhone with high-resolution Retina display running iOS = 6: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="files/images/favicon_114x114.png?v=1">
|
|
<!-- For the iPad mini and the first- and second-generation iPad on iOS = 7: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="files/images/favicon_76x76.png?v=1">
|
|
<!-- For the iPad mini and the first- and second-generation iPad on iOS = 6: -->
|
|
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="files/images/favicon_72x72.png?v=1">
|
|
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
|
|
<link rel="apple-touch-icon-precomposed" href="files/images/favicon_57x57.png?v=1">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
<div class="container">
|
|
|
|
<div class="google-search-bar">
|
|
<script>
|
|
(function() {
|
|
var cx = '007961148920562332911:oocvtwz5jce';
|
|
var gcse = document.createElement('script');
|
|
gcse.type = 'text/javascript';
|
|
gcse.async = true;
|
|
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
|
var s = document.getElementsByTagName('script')[0];
|
|
s.parentNode.insertBefore(gcse, s);
|
|
})();
|
|
</script>
|
|
<gcse:search></gcse:search>
|
|
</div>
|
|
|
|
<div class="content">
|
|
|
|
|
|
|
|
<div class="page-body">
|
|
|
|
|
|
|
|
|
|
<div class="sidebar-nav">
|
|
<h4><a href="Documentation.html">Documentation</a></h4>
|
|
<ul>
|
|
<li><a href="Overview.html">Overview</a></li>
|
|
<li><a href="ReleaseNotes.txt">Release Notes</a></li>
|
|
</ul>
|
|
<strong>Essentials:</strong>
|
|
<ol>
|
|
<li><a href="Installation.html">Installation</a></li>
|
|
<li><a href="QuickStart.html">Quick Start</a></li>
|
|
<li><a href="BasicUsage.html">Basic Usage</a></li>
|
|
<li><a href="Deployment.html">Deployment</a></li>
|
|
<li><a href="BestPractices.html">Best Practices</a></li>
|
|
<li><a href="RewiredEditor.html">Rewired Editor</a></li>
|
|
<li><a href="http://guavaman.com/projects/rewired/docs/api-reference" target="_blank">API Reference</a></li>
|
|
</ol>
|
|
<strong>Concepts:</strong>
|
|
<ul>
|
|
<li><a href="InputManager.html">Input Manager</a></li>
|
|
<li><a href="Players.html">Players</a></li>
|
|
<li><a href="Actions.html">Actions</a></li>
|
|
<li><a href="InputBehaviors.html">Input Behaviors</a></li>
|
|
<li><a href="Controllers.html">Controllers</a></li>
|
|
<li><a href="ControllerMaps.html">Controller Maps</a></li>
|
|
<li><a href="ControllerTemplates.html">Controller Templates</a></li>
|
|
<li><a href="MapCategories.html">Map Categories</a></li>
|
|
<li><a href="Layouts.html">Layouts</a></li>
|
|
<li><a href="LayoutManager.html">Layout Manager</a></li>
|
|
<li><a href="MapEnabler.html">Map Enabler</a></li>
|
|
<li><a href="CustomControllers.html">Custom Controllers</a></li>
|
|
</ul>
|
|
<strong>Extras:</strong>
|
|
<ul>
|
|
<li><a href="ControlMapper.html" title="Control Mapper">Control Mapper</a></li>
|
|
<li><a href="Glyphs.html" title="Glyphs">Glyphs</a></li>
|
|
<li><a href="TouchControls.html" title="Touch Controls">Touch Controls</a></li>
|
|
<li><a href="UnityInputOverride.html" title="Unity Input Override">Unity Input Override</a></li>
|
|
</ul>
|
|
<strong>Misc:</strong>
|
|
<ul>
|
|
<li><a href="RewiredStandaloneInputModule.html">Rewired Standalone Input Module</a></li>
|
|
<li><a href="ComponentControls.html" title="Component Controls">Component Controls</a></li>
|
|
<li><a href="PlayerControllers.html" title="Player Controllers">Player Controllers</a></li>
|
|
<li><a href="InputMapper.html" title="Input Mapper">Input Mapper</a></li>
|
|
<li><a href="UserDataStore.html" title="User Data Store">User Data Store</a></li>
|
|
<li><a href="CustomPlatforms.html" title="User Data Store">Custom Platforms</a></li>
|
|
<li><a href="Localization.html" title="Localization">Localization</a></li>
|
|
</ul>
|
|
<strong>How To's:</strong>
|
|
<ul>
|
|
<li><a href="HowTos.html">See all topics...</a></li>
|
|
</ul>
|
|
<strong>Help:</strong>
|
|
<ul>
|
|
<li><a href="SupportedControllers.html" title="Supported Controllers">Supported Controllers</a></li>
|
|
<li><a href="Overview.html#tested-platforms" title="Tested Platforms">Tested Platforms</a></li>
|
|
<li><a href="Troubleshooting.html" title="Troubleshooting">Troubleshooting</a></li>
|
|
<li><a href="KnownIssues.html">Known Issues</a></li>
|
|
<li><a href="SpecialPlatformSupport.html" title="Special Platform Support">Special Platform Support</a></li>
|
|
<li><a href="Examples.html" title="Examples">Examples</a></li>
|
|
<li><a href="Integration.html">Integrations</a></li>
|
|
<li><a href="Updating.html" title="Updating Rewired">Updating Rewired</a></li>
|
|
</ul>
|
|
<strong>FAQ</strong>
|
|
<ul>
|
|
<li><a href="FAQ.html">See all topics...</a></li>
|
|
</ul>
|
|
<strong>Unity Help:</strong>
|
|
<ul>
|
|
<li><a href="http://docs.unity3d.com/Manual/" target="_blank">Unity Manual</a></li>
|
|
<li><a href="http://docs.unity3d.com/ScriptReference/" target="_blank">Unity Script Reference</a></li>
|
|
<li><a href="http://unity3d.com/learn/tutorials/modules" target="_blank">Unity Tutorials</a></li>
|
|
</ul>
|
|
<strong>Links:</strong>
|
|
<ul>
|
|
<li><a href="http://guavaman.com/projects/rewired">Rewired Website</a></li>
|
|
<li><a href="http://guavaman.com/projects/rewired/docs">Web Documentation</a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<div class="main-body">
|
|
<div class="logo"><a href="http://guavaman.com/projects/rewired" title="Rewired"><img src="files/images/rewired-logo.png" width="173" height="139" alt="Rewired" /></a></div>
|
|
|
|
<h1>
|
|
<!-- InstanceBeginEditable name="PageHeader" -->Glyphs
|
|
<!-- InstanceEndEditable -->
|
|
</h1>
|
|
|
|
<!-- InstanceBeginEditable name="MainBody" -->
|
|
|
|
<p>As of version 1.1.56.0, Rewired includes a glyph system that can be used to display glyphs for controller elements. Rewired comes with a default set of glyphs for some commonly-used controllers and components to display them in Unity UI. (Unity 5+)</p>
|
|
<p>The glyph system was written to be highly customizable. The included glyph sets use Unity's Sprite and Unity UI, but the system could be modified to use any data format or UI system (advanced developers only).</p>
|
|
<p><img src="files/images/glyphs-example-glyphs.png" width="300" height="219" alt="Some glyphs" /></p>
|
|
<h3><a name="contents" id="contents"></a>Contents</h3>
|
|
<ul>
|
|
<li><a href="#installation">Installation</a></li>
|
|
<li><a href="#quick-setup">Quick Setup</a></li>
|
|
<li><a href="#namespace">Namespace</a></li>
|
|
<li><a href="#important-classes">Important Classes</a></li>
|
|
<li><a href="#glyph-provider">Glyph Provider</a></li>
|
|
<li><a href="#unity-ui-player-controller-element-glyph">Unity UI Player Controller Element Glyph</a></li>
|
|
<li><a href="#unity-ui-controller-element-glyph">Unity UI Controller Element Glyph</a></li>
|
|
<li><a href="#default-unity-ui-controller-element-glyph-settings">Default Unity UI Controller Element Glyph Settings</a></li>
|
|
<li><a href="#glyph-set">Glyph Set</a></li>
|
|
<li><a href="#glyph-set-collection">Glyph Set Collection</a></li>
|
|
<li><a href="#custom-glyph-types">Custom Glyph Types (Advanced)</a></li>
|
|
<li><a href="#unity-ui-text-mesh-pro-glyph-helper">Unity UI Text Mesh Pro Glyph Helper</a></li>
|
|
<li><a href="#accessing-glyphs-from-scripts">Accessing Glyphs from Scripts</a></li>
|
|
<li><a href="#key-format">Key Format</a></li>
|
|
</ul>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="installation" id="installation"></a>Installation</h3>
|
|
<p>Install the Glyphs pack from the menu:</p>
|
|
<ul>
|
|
<li>Window -> Rewired -> Extras -> Glyphs -> Install</li>
|
|
</ul>
|
|
<p>Rewired will automatically install an additional addon pack if Text Mesh Pro is installed in the project. If you installed the glyphs pack before Text Mesh Pro was installed, you will be unable to use features that are dependent upon Text Mesh Pro. After installing Text Mesh Pro, install the glyphs pack again.</p>
|
|
<p><strong>Uninstalling</strong></p>
|
|
<p> Delete the Rewired/Extras/Glyphs folder.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="quick-setup" id="quick-setup"></a>Quick Setup</h3>
|
|
<p>Add the Glyph Provider component to the Rewired Input Manager (or a child object) by selecting the Game Object and from the menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Glyphs -> Glyph Provider<br />
|
|
</li>
|
|
</ul>
|
|
<p>This will add the component and automatically assign the default glyph collection. </p>
|
|
<p><strong>Displaying Glyphs
|
|
</strong></p>
|
|
<p>To display a glyph, select a Canvas (or child of Canvas) and create a Unity UI Player Controller Element Glyph from the menu:</p>
|
|
<ul>
|
|
<li>GameObject -> Create Other -> Rewired -> Glyphs -> Unity UI -> Unity UI Player Controller Element Glyph</li>
|
|
</ul>
|
|
<p>Set the required inspector options:</p>
|
|
<ul>
|
|
<li>Player Id: The id of the Player.</li>
|
|
<li>Action Name: The name of the Action.</li>
|
|
<li>Action Range: The range of the Action for which to show glyphs / text. This determines whether to show the glyph for an axis-type Action (ex: Move Horizontal), or the positive/negative pole of an Action (ex: Move Right). For button-type Actions, Full and Positive are equivalent.</li>
|
|
</ul>
|
|
<p><a href="#unity-ui-text-mesh-pro-glyph-helper">Or, see this to display glyphs inline in Text Mesh Pro text.</a></p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="namespace" id="namespace"></a>Namespace</h3>
|
|
<p>All Glyph-related classes are in the Rewired.Glyphs namespace.</p>
|
|
<pre class="code">using Rewired.Glyphs;
|
|
// If using Unity UI classes
|
|
using Rewired.Glyphs.UnityUI;</pre>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="important-classes" id="important-classes"></a>Important Classes</h3>
|
|
<ul>
|
|
<li><a href="https://guavaman.com/projects/rewired/docs/api-reference/html/Properties_T_Rewired_ReInput_GlyphHelper.htm">ReInput.GlyphHelper</a> - Provides access to all glyph-related members. Access via ReInput.glyphs.</li>
|
|
</ul>
|
|
<p> </p>
|
|
<p></p>
|
|
<hr />
|
|
<h3><a name="glyph-provider" id="glyph-provider"></a>Glyph Provider</h3>
|
|
<p>The glyph provider is responsible for performing a string key lookup and returning a glyph. A glyph provider is required to use the glyph system.</p>
|
|
<p>Any class that implements Rewired.Interfaces.IGlyphProvider can be used as the glyph provider by assigning it to ReInput.glyphs.glyphProvider. The GlyphProvider component implements this interface and sets itself as the glyph provider in OnEnable. (The glyph provider should always null the ReInput.glyphs.glyphProvider property when no longer needed, usually in OnDisable.)</p>
|
|
<p>If you want to implement your own glyph provider, you can extend the GlyphProvider class, or create a new class that implements Rewired.Interfaces.IGlyphProvider.</p>
|
|
<p><strong> GlyphProvider</strong></p>
|
|
<p>The GlyphProvider component is the default implementation of a glyph provider.</p>
|
|
<p>Add the Glyph Provider component to the Rewired Input Manager (or a child object) by selecting the Game Object and from the menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Glyphs -> Glyph Provider</li>
|
|
</ul>
|
|
<p><strong><a name="glyph-provider-inspector" id="glyph-provider-inspector"></a>Inspector</strong></p>
|
|
<p><img src="files/images/glyphs-glyph-provider-inspector.png" alt="Glyph Provider Inspector" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td width="22%" valign="top"><strong><a name="glyph-provider-prefetch" id="glyph-provider-prefetch"></a></strong>Prefetch</td>
|
|
<td width="78%" valign="top"><p>Determines if glyphs should be fetched immediately in bulk when available. If false, glyphs will be fetched when queried.</p>
|
|
<p>By default, glyphs are fetched on an as-needed basis. That is, no key lookup is done until the glyph is first displayed. If you want all keys for connected devices to be loaded in bulk, set prefetch to true in the Glyph Provider inspector, or in code, ReInput.glyphs.prefetch = true. Controllers that are not presently connected cannot have their glyphs prefetched, but if prefetch is enabled, all glyphs for that controller will be fetched when it is connected.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Glyph Set Collections</td>
|
|
<td valign="top"><p>A list of glyph set collections. At least one collection must be assigned.<br />
|
|
</p></td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p><strong><a name="caching" id="caching"></a>Caching</strong></p>
|
|
<p>Glyphs are cached when returned from the glyph provider. This prevents wasting CPU resources by constantly doing expensive string key lookups. The glyph cache can be cleared by calling ReInput.glyphs.Reload. The cache will also be cleared automatically after setting a new glyph provider.</p>
|
|
<p><strong><a name="glyph-provider-changing-glyphs-at-runtime" id="glyph-provider-changing-glyphs-at-runtime"></a>Changing Glyphs at Runtime</strong></p>
|
|
<p>You might want to create a different set of glyphs to display different characters for keys on for the specific language of keyboard in use, for example. You can create your own Glyph Set and swap out glyphs based on the current keyboard in use. (Note: Rewired does not provide any keyboard layout or locale information from the operating system on any platform. This would have to be implemented by the developer on a per-platform basis.)</p>
|
|
<p>You can either change out the entire Glyph Set Collection in the Glyph Provider, or you can change out one or more Glyph Sets assigned to a particular collection. When the collection list is replaced in Glyph Provider, it will automatically collect all the glyphs from all chained glyph collections and clear the glyph cache so glyphs can be reloaded. If you change an element in the collection list or one of the chained collections, you must call GlyphProvider.Reload to collect all the glyphs and clear the glyph cache.</p>
|
|
<p>You can also replace the Glyph Provider and all cached glyphs will be cleared automatically. Just set ReInput.glyphs.glyphProvider to your new provider.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="unity-ui-player-controller-element-glyph" id="unity-ui-player-controller-element-glyph"></a>Unity UI Player Controller Element Glyph</h3>
|
|
<p>This component is responsible for displaying the glyph(s) or text for a particular Action, Player, and Action Range. If a glyph is not available, text will be displayed instead.</p>
|
|
<p>Create a GameObject with the default values from the menu:</p>
|
|
<ul>
|
|
<li>GameObject -> Create Other -> Rewired -> Glyphs -> Unity UI -> Unity UI Player Controller Element Glyph</li>
|
|
</ul>
|
|
<p><strong><a name="unity-ui-player-controller-element-glyph-inspector" id="unity-ui-player-controller-element-glyph-inspector"></a>Inspector</strong></p>
|
|
<p><img src="files/images/glyphs-unity-ui-player-controller-element-glyph-inspector.png" alt="Unity UI Player Controller Element Glyph Inspector" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td width="22%" valign="top">Glyph or Text Prefab</td>
|
|
<td width="78%" valign="top">If set, when glyph/text objects are created, they will be instantiated from this prefab. If left blank, the global default prefab will be used.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Allowed Types</td>
|
|
<td valign="top"><p>Determines what types of objects are allowed.</p>
|
|
<ul>
|
|
<li> All - All types are allowed. Glyphs will be displayed, or text if no glyph is available.</li>
|
|
<li> Glyphs - Only glyphs will be displayed.</li>
|
|
<li> Text - Only text will be displayed.<br />
|
|
</li>
|
|
</ul></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Options</td>
|
|
<td valign="top">Optional reference to an object that defines options. If blank, the global default options will be used.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Action Range</td>
|
|
<td valign="top">The range of the Action for which to show glyphs / text. This determines whether to show the glyph for an axis-type Action (ex: Move Horizontal), or the positive/negative pole of an Action (ex: Move Right). For button-type Actions, Full and Positive are equivalent.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Group 1</td>
|
|
<td valign="top">Optional parent Transform of the first group of instantiated glyph / text objects. If an axis-type Action is bound to multiple elements, the glyphs bound to the negative pole of the Action will be instantiated under this Transform. This allows you to separate negative and positive groups in order to stack glyph groups horizontally or vertically, for example. If an Action is only bound to one element, the glyph will be instantiated under this transform. If blank, objects will be created as children of this object's Transform.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Group 2</td>
|
|
<td valign="top">Optional parent Transform of the second group of instantiated glyph / text objects. If an axis-type Action is bound to multiple elements, the glyphs bound to the positive pole of the Action will be instantiated under this Transform. This allows you to separate negative and positive groups in order to stack glyph groups horizontally or vertically, for example. If an Action is only bound to one element, the glyph will be instantiated under group1 instead. If blank, objects will be created as children of either group1 if set or the object's Transform.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Player Id</td>
|
|
<td valign="top">The Player id.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Action Name</td>
|
|
<td valign="top">The Action name.</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p><strong><a name="controller-element-glyph-selector-options" id="controller-element-glyph-selector-options"></a>Options</strong></p>
|
|
<p>Various options can be set that determine which glyph will be selected. This includes choosing to use the last active controller or not and the priority order of different controller types. For example, you might choose to prioritze keyboard glyphs over mouse glyphs or vice versa. (In this class, the keyboard and mouse are treated as a single controller for the purposes of last active controller.)</p>
|
|
<p>If the options field is left blank, it will use the default options specified in ControllerElementGlyphSelectorOptions.defaultOptions. You can set this value or change the individual options values and all glyphs that use the default options will reflect these changes. (You can also set the default options in the inspector <a href="#default-unity-ui-controller-element-glyph-settings">using this convenience component</a>.) If the options field is set, the local options will be used.</p>
|
|
<p>You can create a selector options asset file and share the settings among different glyphs. The options field takes a reference to an object of type ControllerElementGlyphSelectorOptionsSOBase. You can create a ControllerElementGlyphSelectorOptionsSO from the menu:</p>
|
|
<ul>
|
|
<li>Assets -> Create -> Rewired -> Glyphs -> Controller Element Glyph Selector Options</li>
|
|
</ul>
|
|
<p><strong><a name="glyph-or-text-prefab" id="glyph-or-text-prefab"></a>Glyph or Text Prefab</strong></p>
|
|
<p>It is important to understand that an Action Element Map may be bound to a number of different controller elements. Also, the two poles of an Action (positive, negative) may be bound on separate Action Element Maps. This means, when querying for an Action Range of Full, it is possible that up to 8 glyphs will need to be displayed. (One set of 3 keyboard modifier keys and 1 primary key for up to the two poles of a split axis Action.) This class handles that, and will instantiate enough child objects as necessary from the specified prefab.</p>
|
|
<p>To create the individual glyph or text objects, a prefab is used to instantiate the child objects. By default, no prefab is set, so it will use the current default prefab. By default, it is created automatically by Rewired, but it can be overridden. If a glyph or text prefab is set locally, it will be used, otherwise it will fall back to the default.</p>
|
|
<p>The root GameObject of the prefab must include a component that inherits from GlyphOrTextBase.</p>
|
|
<p><strong><a name="default-glyph-or-text-prefab" id="default-glyph-or-text-prefab"></a>Default Glyph or Text Prefab</strong></p>
|
|
<p> The default Unity UI glyph or text prefab is specified in UnityUIControllerElementGlyphBase.defaultGlyphOrTextPrefab. You can set this to override the default prefab for all Unity UI glyphs at once by setting that value. (You can also set the default prefab in the inspector <a href="#default-unity-ui-controller-element-glyph-settings">using this convenience component</a>.) Existing glyph objects will be automatically rebuilt when changing this value. You should not modify the existing default prefab by changing values on it, but instead replace it with a new GameObject, otherwise existing glyphs will not be rebuilt because they detect changes to the prefab by comparing object references.</p>
|
|
<p><strong><a name="unity-ui-player-controller-element-glyph-child-object-layout" id="unity-ui-player-controller-element-glyph-child-object-layout"></a>Child Object Layout</strong></p>
|
|
<p>The default UnityUIPlayerControllerElementGlyph when created from Component -> Rewired -> Glyphs -> Glyph Provider includes a HorizontalLayout component. In the case multiple glyphs are displayed, they will be aligned horizontally. If you want them to be laid out vertically, remove the HorizontalLayout component and replace it with a VerticalLayout component. Or, you can choose to use any type of layout available in Unity UI, but be aware you may need to replace the prefab used for the child objects to fully control layout.</p>
|
|
<p><strong><a name="unity-ui-player-controller-element-glyph-groups" id="unity-ui-player-controller-element-glyph-groups"></a>Groups</strong></p>
|
|
<p>By default, child objects will be created as children of the primary GameObject. However, for some layouts, you may want to group child objects. The group1 and group2 fields allow you specify Transforms which will be used as the parents for child objects. Most child objects will be displayed under group1, however, if you are querying for an Axis-type Action, Full Action Range, and it finds a separate binding for each pole of the axis, the glyphs/text for the negative pole will be displayed in group1 and the glyphs/text for the positive pole will be displayed in group2.</p>
|
|
<p>While this is probably a very rare scenario, the most likely use case for this would be in the case of keyboard bindings with modifier keys. For example, if you have bindings to two poles of an Action, Ctrl + A, Ctrl + S, you can stack these groups of horizontal elements vertically to save horizontal space. You would do this by placing a VerticalLayoutGroup component on the primary GameObject, then create two child GameObjects, Group1 and Group2, then on each Group, add a HorizontalLayoutGroup component.</p>
|
|
<p><strong><a name="unity-ui-player-controller-element-glyph-player-action-dropdowns" id="unity-ui-player-controller-element-glyph-player-action-dropdowns"></a>Player and Action Dropdowns in the Inspector</strong></p>
|
|
<p><img src="files/images/glyphs-player-action-dropdowns.png" alt="Player Action Dropdowns" /></p>
|
|
<p>It is recommended that you configure the Player Id and Action Id values using dropdowns in the inspector instead of using raw ints and strings for these values. This avoids possible error, and also makes it a lot easier if you want to change the name of an Action at a later date.</p>
|
|
<p>To do this, first you must <a href="HowTos.html#exporting-constants">export constants</a> for your Rewired Input Manager configuration.</p>
|
|
<p>Next, create a class that extends UnitUIPlayerControllerElementGlyphBase and add PlayerIdProperty and ActionIdProperty attributes, referencing the exported types. Replace the script reference of the UnityUIPlayerControllerElementGlyph with your new class. (Switch inspector to Debug mode by right clicking the Inspector tab, choosing Debug. The Script field can be replaced with your new script.)</p>
|
|
<pre class="code">
|
|
using Rewired;
|
|
using Rewired.Glyphs.UnityUI;
|
|
using UnityEngine;
|
|
|
|
namespace MyNamespace {
|
|
|
|
public class MyUnityUIPlayerControllerElementGlyph : UnityUIPlayerControllerElementGlyphBase {
|
|
|
|
[SerializeField]
|
|
[PlayerIdProperty(typeof(MyRewiredConsts.Player))]
|
|
private int _playerId;
|
|
|
|
[SerializeField]
|
|
[ActionIdProperty(typeof(MyRewiredConsts.Action))]
|
|
private int _actionId;
|
|
|
|
public override int playerId { get { return _playerId; } set { _playerId = value; } }
|
|
public override int actionId { get { return _actionId; } set { _actionId = value; } }
|
|
}
|
|
}</pre>
|
|
<p></p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="unity-ui-controller-element-glyph" id="unity-ui-controller-element-glyph"></a>Unity UI Controller Element Glyph</h3>
|
|
<p>This component displays glyphs / text for a specific Action Element Map or Controller Element Identifier using Unity UI.</p>
|
|
<p>This component cannot be used alone. It requires a script to set either the actionElementMap property or the controllerElementIdentifier and axisRange properties. This is mainly useful if you need to display a glyph for a specific controller element, such as when showing a list of glyphs for controller elements in a controller or when showing glyphs for controller elements currently contributing to an Action value. If you want to display a glyph for a controller element bound to an Action for a Player, use <a href="#unity-ui-player-controller-element-glyph">Unity UI Player Controller Element Glyph</a> instead.</p>
|
|
<p>Add component from menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Glyphs -> Unity UI -> Unity UI Controller Element Glyph</li>
|
|
</ul>
|
|
<p>Inspector</p>
|
|
<p><img src="files/images/glyphs-unity-ui-controller-element-glyph-inspector.png" alt="Unity UI Controller Element Glyph Inspector" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">Glyph or Text Prefab</td>
|
|
<td valign="top">If set, when glyph/text objects are created, they will be instantiated from this prefab. If left blank, the global default prefab will be used.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Allowed Types</td>
|
|
<td valign="top"><p>Determines what types of objects are allowed.</p>
|
|
<ul>
|
|
<li> All - All types are allowed. Glyphs will be displayed, or text if no glyph is available.</li>
|
|
<li> Glyphs - Only glyphs will be displayed.</li>
|
|
<li> Text - Only text will be displayed.<br />
|
|
</li>
|
|
</ul></td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="default-unity-ui-controller-element-glyph-settings" id="default-unity-ui-controller-element-glyph-settings"></a>Default Unity UI Controller Element Glyph Settings</h3>
|
|
<p>This is a convenience component that allows you to set default Unity UI glyph settings in the inspector. This allows you to change settings easily in one place and any glyph that doesn't set local options or prefab settings but instead falls back to default options will use these values.</p>
|
|
<p>Add component from menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Glyphs -> Unity UI -> Unity UI Default Controller Element Glyph Settings</li>
|
|
</ul>
|
|
<p><strong><a name="default-unity-ui-controller-element-glyph-settings-inspector" id="default-unity-ui-controller-element-glyph-settings-inspector"></a>Inspector</strong></p>
|
|
<p><img src="files/images/glyphs-default-unity-ui-controller-element-glyph-settings.png" width="463" height="202" alt="Default Unity UI Controller Element Glyph Settings" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td width="22%" valign="top">Options</td>
|
|
<td width="78%" valign="top">The Controller element glyph options.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Use Last Active Controller</td>
|
|
<td valign="top">Determines if the Player's last active controller is used for glyph selection.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Controller Type Order</td>
|
|
<td valign="top"><p>List of controller type priority.
|
|
First in list corresponds to highest priority.</p>
|
|
<p>This determines which controller types take precedence when displaying glyphs. If use last active controller is enabled, the active controller will always take priority, however, if there is no last active controller, selection will fall back based on this priority.</p>
|
|
<p> In addition, keyboard and mouse are treated as a single controller for the purposes of glyph handling, so to prioritze keyboard over mouse or vice versa, the one that is lower in the list will take precedence.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Glyph or Text Prefab</td>
|
|
<td valign="top"><p>The prefab used for each glyph or text object.</p>
|
|
<p><a href="#glyph-or-text-prefab">See this for more information.</a></p></td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="glyph-set" id="glyph-set"></a>Glyph Set</h3>
|
|
<p>A glyph set represents a list of string-keyed glyphs. You can create your own glyphs, for example, if you want different styling, to create glyphs for a controller that doesn't have any default glyphs, to create glyphs for your Custom Controllers, etc.</p>
|
|
<p>The default implementation is SpriteGlyphSet. This uses UnityEngine.Sprite as the glyph type. It is possible to use your own custom glyph types. <a href="#custom-glyph-types">See this for more information</a>.</p>
|
|
<p><strong><a name="sprite-glyph-set" id="sprite-glyph-set"></a>SpriteGlyphSet</strong></p>
|
|
<p>A Sprite glyph set for a controller or controller template. The inspector contains various convenience tools for generating glyph sets from controller and controller template definitions and Custom Controllers.</p>
|
|
<p>To create a Sprite Glyph Set:</p>
|
|
<ul>
|
|
<li>Assets -> Create -> Rewired -> Glyphs -> Sprite Glyph Set</li>
|
|
</ul>
|
|
<p><strong><a name="sprite-glyph-set-inspector" id="sprite-glyph-set-inspector"></a>Inspector</strong></p>
|
|
<p><img src="files/images/glyphs-sprite-glyph-set-inspector.png" alt="Sprite Glyph Set Inspector" /><br/>
|
|
</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td width="22%" valign="top">Base Keys</td>
|
|
<td width="78%" valign="top">A list of base keys. Final keys will be composed of base key + glyph key. Setting multiple base keys allows one glyph set to apply to multiple controllers, for example.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Glyphs</td>
|
|
<td valign="top">The list of glyphs.</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="glyph-set-collection" id="glyph-set-collection"></a>Glyph Set Collection</h3>
|
|
<p>A glyph set collection represents a list of glyph sets. This can be used to organize glyph sets into categories to work with them more easily. Glyph Set Collections can be chained, allowing you to organize glyph sets under one top-level collection, making it easy to swap out the entire set of glyphs for a different set. Examples of this might include having different glyph styles for different consoles / platforms or for localization purposes.</p>
|
|
<p><strong><a></a>GlyphSetCollection</strong></p>
|
|
<p>To create a Glyph Set Collection:</p>
|
|
<ul>
|
|
<li>Assets -> Create -> Rewired -> Glyphs -> Glyph Set Collection</li>
|
|
</ul>
|
|
<p><strong><a name="glyph-set-collection-so-inspector" id="glyph-set-collection-so-inspector"></a>Inspector</strong></p>
|
|
<p><img src="files/images/glyph-set-collection-inspector.png" alt="Glyph Set Collection Inspector" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td width="22%" valign="top">Sets</td>
|
|
<td width="78%" valign="top">The list of glyph sets.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Collections</td>
|
|
<td valign="top">The list of glyph set collections.</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="custom-glyph-types" id="custom-glyph-types"></a>Custom Glyph Types (Advanced)</h3>
|
|
<p>Glyphs are exposed by the API as System.Object. This allows you to use any object type you want as a glyph and still access it through the API. You are not limited to UnityEngine.Sprite.</p>
|
|
<p>The various glyph set and glyph set collection classes can be reimplemented from their base classes to support any glyph object type.</p>
|
|
<ul>
|
|
<li>Create a class that inherits from GlyphSet, the base class of SpriteGlyphSet, specifying the new type. Copy the code of SpriteGlyphSet to start. (The Sprite Glyph Set custom inspector will also need to be copied and re-implemented if you want those features.)</li>
|
|
<li>Create a class that inherits from GlyphOrTextBase<TGlyphComponent, TGlyphGraphic, TTextComponent>. Copy the code of UnityUIGlyphOrText to start. Create a new GlyphOrText prefab using the new class, then <a href="#default-glyph-or-text-prefab">set that prefab to the default UnityUI glyph or text prefab</a>.</li>
|
|
</ul>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="unity-ui-text-mesh-pro-glyph-helper" id="unity-ui-text-mesh-pro-glyph-helper"></a>Unity UI Text Mesh Pro Glyph Helper</h3>
|
|
<p><img src="files/images/glyphs-unity-ui-text-mesh-pro-glyph-helper-example1.png" alt="Press A to Shoot" width="362" height="100" style="float: right; margin-left: 2em; padding-bottom: 2em;" />A helper class to display Rewired glyphs and display names inline in TMPro Text (Unity UI). Parses tags within text and replaces them with Sprites or text. Enter text in this component's text field, not in the TMPro Text field. Text entered here will be parsed, then the Text Mesh Pro Text component will be updated with the text, including Sprite tags.</p>
|
|
<p>To use it, create a Text Mesh Pro UGUI object, select the GameObject, and add the component from the menu:</p>
|
|
<ul>
|
|
<li>Component -> Rewired -> Glyphs -> Unity UI -> Unity UI Text Mesh Pro Glyph Helper</li>
|
|
</ul>
|
|
<p> </p>
|
|
<p><strong>Inspector</strong></p>
|
|
<p><img src="files/images/glyphs-unity-ui-text-mesh-pro-glyph-helper-inspector.png" alt="Unity UI Text Mesh Pro Glyph Helper Inspector" /></p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">Text</td>
|
|
<td valign="top">Enter text into this field and not in the TMPro Text field directly. Text will be parsed for special tags, and the final result will be passed on to the Text Mesh Pro Text component. <a href="#unity-ui-text-mesh-pro-glyph-helper-tags">See this for more information about tags.</a></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="22%" valign="top">Options</td>
|
|
<td width="78%" valign="top">Optional reference to an object that defines options. If blank, the global default options will be used.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Sprite Options</td>
|
|
<td valign="top"><p>Options that control how Text Mesh Pro displays Sprites.</p>
|
|
<ul>
|
|
<li>Scale - Scale.</li>
|
|
<li>Offset Size Multiplier - This value will be multiplied by the Sprite width and height and applied to offset.</li>
|
|
<li>Extra Offset - An extra offset that is cumulative with Offset Size Multiplier.</li>
|
|
<li>X Advance Width Multiplier - This value will be multiplied by the Sprite width applied to X Advance.</li>
|
|
<li>Extra X Advance - An extra offset that is cumulative with X Advance Width Multiplier.</li>
|
|
</ul> </td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Base Sprite Material</td>
|
|
<td valign="top">Optional material for Sprites. If blank, the default material will be used. Material is instantiated for each Sprite Asset, so making changes to values in the base material later will not affect Sprites. Changing the base material at runtime will copy only certain properties from the new material to Sprite materials.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top"><p>Override Sprite Material Properties</p></td>
|
|
<td valign="top">If enabled, local values such as Sprite color will be used instead of the value on the base material.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">Sprite Material Properties</td>
|
|
<td valign="top"><p>These properties will override the properties on the Sprite material if Override Sprite Material Properties is enabled.</p>
|
|
<ul>
|
|
<li>Color - Sprite material color.</li>
|
|
</ul></td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p><strong><a name="unity-ui-text-mesh-pro-glyph-helper-tags" id="unity-ui-text-mesh-pro-glyph-helper-tags"></a>Tags:</strong></p>
|
|
<p>Text containing the below tags will be converted into glyphs / text for the specified parameters.</p>
|
|
<pre><strong>Display glyph / text for a controller element bound to an Action for a Player:</strong>
|
|
|
|
<rewiredElement [attributes]>
|
|
|
|
Attributes:
|
|
type="[glyphOrText|glyph|text]" (optional, default: glyphOrText)
|
|
playerId=[player_id] (id or name required)
|
|
playerName="[player_name]" (id or name required)
|
|
actionId=[action_id] (id or name required)
|
|
actionName="[action_name]" (id or name required)
|
|
actionRange="[full|positive|negative]" (optional, default: full)
|
|
|
|
Example:
|
|
<rewiredElement playerId=5 actionName="MoveHorizontal" actionRange="full">
|
|
|
|
<strong>Display the name of an Action:</strong>
|
|
|
|
<rewiredAction [attributes]>
|
|
|
|
Attributes:
|
|
id=[action_id] (id or name required)
|
|
name=[action_name] (id or name required)
|
|
range="[full|positive|negative]" (optional, default: full)
|
|
|
|
Example:
|
|
<rewiredAction name="MoveHorizontal" range="positive">
|
|
|
|
<strong>Display the name of a Player:</strong>
|
|
|
|
<rewiredPlayer [attributes]>
|
|
|
|
Attributes:
|
|
id=[action_id] (id or name required)
|
|
name=[action_name] (id or name required)
|
|
|
|
Example:
|
|
<rewiredPlayer id=0>
|
|
</pre>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="accessing-glyphs-from-scripts" id="accessing-glyphs-from-scripts"></a>Accessing Glyphs from Scripts</h3>
|
|
<p>The various glyph-related members are as follows:</p>
|
|
<ul>
|
|
<li>ControllerElementIdentifier.glyph</li>
|
|
<li>ControllerElementIdentifier.positiveGlyph</li>
|
|
<li>ControllerElementIdentifier.negativeGlyph</li>
|
|
<li>ControllerTemplateElementIdentifier.glyph</li>
|
|
<li>ControllerTemplateElementIdentifier.positiveGlyph</li>
|
|
<li>ControllerTemplateElementIdentifier.negativeGlyph</li>
|
|
<li>ActionElementMap.glyph</li>
|
|
<li>ActionElementMap.positiveGlyph</li>
|
|
<li>ActionElementMap.negativeGlyph</li>
|
|
<li>ActionElementMap.GetElementIdentifierGlyphs</li>
|
|
</ul>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="key-format" id="key-format"></a>Key Format</h3>
|
|
<p>Glyph keys are strings that are formatted as a path.</p>
|
|
<p>All keys, with the exception of <a href="#keys-special-matching">special fallback keys</a>, can be exported from the <a href="RewiredEditor.html#Tools">Rewired Editor -> Tools page</a>.</p>
|
|
<p>Note: The [brackets] below are not part of the key. Items in brackets represent a variable value.</p>
|
|
<p><strong><a name="key-format-controller-keys" id="key-format-controller-keys"></a>Controller-related keys</strong></p>
|
|
<p>For recognized controllers of all types:</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">controller/[controller_key]</td>
|
|
<td valign="top"><p>A specific controller.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td width="78%" valign="top">controller/[controller_key]/[element_key]</td>
|
|
<td width="22%" valign="top"><p>An element on a specific controller.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/keyboard</td>
|
|
<td valign="top">The keyboard.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/keyboard/[element_key]</td>
|
|
<td valign="top">A keyboard key.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/mouse</td>
|
|
<td valign="top">The mouse.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/mouse/[element_key]</td>
|
|
<td valign="top">A mouse element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/custom/[controller_key]</td>
|
|
<td valign="top">A specific custom controller.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/custom/[controller_key]/[element_key]</td>
|
|
<td valign="top">An element on a specific custom controller.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/element/[element_key]</td>
|
|
<td valign="top">A generic controller element.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/template/[controller_template_key]</td>
|
|
<td valign="top">A specific controller template.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/template/[controller_template_key]/[element_key]</td>
|
|
<td valign="top">An element on a specific controller template.</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p>Example:<br />
|
|
The glyph key for an Xbox One controller is:<br />
|
|
controller/microsoft_xbox_one_controller</p>
|
|
<p>The glyph key for the left stick horizontal axis on an Xbox One controller is:<br />
|
|
controller/microsoft_xbox_one_controller/left_stick/horizontal</p>
|
|
<p><strong><a name="keys-unrecognized-controllers" id="keys-unrecognized-controllers"></a>Unrecognized Controllers</strong></p>
|
|
<p>On most platforms, unrecognized controllers will use the Unknown Controller definition and its keys. On specific platforms when using specific input sources, handling for unrecognized controllers of specific types may be handled differently. <a href="#keys-special-matching">See this</a>.</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">controller/unknown_controller</td>
|
|
<td valign="top">Unknown Controller.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/unknown_controller/[element_key]</td>
|
|
<td valign="top">An element on an Unknown Controller.</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p><strong><a name="keys-fallback-matching" id="keys-fallback-matching"></a>Fallback Matching</strong></p>
|
|
<p>When controller element glyph key lookups are performed, if a matching glyph is not found, additional keys will be tried. Most-specific keys are tried first, falling back progressively to least-specific until a match is found or no there are no more fallback options.</p>
|
|
<p>Keys in the tables below are listed in order of precedence, with first in list being highest precedence. This list applies to recognized Joysticks.</p>
|
|
<p><br />
|
|
</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top">controller/[controller_key]/[input_source_hardware_info]/[element_key]</td>
|
|
<td valign="top"><p>Hardware Specific</p>
|
|
Rare special case for certain devices on some input sources / platforms. See below.</td>
|
|
</tr>
|
|
<tr>
|
|
<td width="78%" valign="top">controller/[controller_key]/[element_key]</td>
|
|
<td width="22%" valign="top"><p>Base Controller</p>
|
|
<p>This is the most common match type.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/[input_source_special_controller_key]/[element_key]</td>
|
|
<td valign="top"><p>Input Source Special Fallback</p>
|
|
<p>Only if controller on current input source has additional fallbacks.</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/element/[element_key]</td>
|
|
<td valign="top">Element Only Fallback</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/template/[element_key]</td>
|
|
<td valign="top"><p>Controller Template</p>
|
|
<p>Only if controller implements a Controller Template.</p></td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<p><strong><a name="keys-element-only-fallback" id="keys-element-only-fallback"></a>Element Only Fallback</strong></p>
|
|
<p>If no glyph is found for the specific controller, you can still match on element only. This allows you to define glyphs for generic controller elements without knowing anything about the controller they may appear on. For example, creating a glyph with the key controller/element/dpad/up will match to any controller element that has the key dpad/up. This isn't terribly useful for gamepads, because they will be handled by Controller Template fallback (see below), but for other controller types, this may prove useful. (Racing wheels, flight sticks, Custom Controllers, etc.)</p>
|
|
<p><strong><a name="keys-controller-template-fallback" id="keys-controller-template-fallback"></a>Controller Template Fallback</strong></p>
|
|
<p>You can see from the above list that, if a controller implements a Controller Template, if no matching keys are found for the specific device or the elements themselves, it will fallback to Controller Template keys for the controller elements. For example, this allows all recognized gamepads that implement the Gamepad Template to automatically display Gamepad Template glyphs. If controller-specific glyphs are available, they will take precedence over Template glyphs.</p>
|
|
<p><strong><a name="keys-special-matching" id="keys-special-matching"></a>Special Matching on Specific Input Source</strong>s</p>
|
|
<p>On specific platforms, when using specific input sources, for specific devices, additional key variants may be used. In some cases, these key variants are more specific and will be attempted before the primary key, in other cases the key variants are act as additional fallback options.</p>
|
|
<p>Keys in the tables below are listed in order of precedence, with first in list being highest precedence.</p>
|
|
<p><strong><a name="keys-special-matching-limitations" id="keys-special-matching-limitations"></a>IMPORTANT LIMITATIONS:</strong></p>
|
|
<p>Because the below special keys rely on information supplied by a connected controller, you cannot get glyphs or localized strings for these special keys when the controller is not connected. The ReInput.mapping.GetControllerMapInstance functions to see mappings for a non-connected controller cannot generate these special keys because they are dependent on data supplied by the hardware. To avoid issues, if you intend to display glyphs or element names for controllers that are not connected, do not localize names or make glyphs for these special special keys below.</p>
|
|
<p> </p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>Windows Gaming Input, unrecognized, Gamepad profile:</strong></td>
|
|
<td valign="top">(Element keys from Xbox One Controller definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" valign="top">This list only applies to unrecognized controllers. For recognized devices, such as Dual Shock 4, the following does not apply.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/windows_gaming_input_gamepad/[vendor_id_hex:product_id_hex]</td>
|
|
<td valign="top">Specific hardware target<br />
|
|
Vendor / Product Id example:<br />
|
|
045e:0202 (lower case)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/windows_gaming_input_gamepad</td>
|
|
<td valign="top">Universal fallback gamepad</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/microsoft_xbox_one_controller</td>
|
|
<td valign="top">Xbox One fallback</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" valign="top"> </td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top"><strong>Windows Gaming Input, Steam-Configured, unrecognized, Gamepad profile:</strong></td>
|
|
<td valign="top">(Element keys from Steam Controller definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" valign="top">This list only applies to unrecognized controllers. For recognized devices, such as Dual Shock 4, the following does not apply.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/steam_controller/[vendor_id_hex:product_id_hex]</td>
|
|
<td valign="top"><p>Specific hardware target<br />
|
|
Vendor / Product Id example:<br />
|
|
045e:0202 (lower case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/steam_controller</td>
|
|
<td valign="top">Steam Controller fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>MacOS, Game Controller Framework, unrecognized, Gamepad profile:</strong></td>
|
|
<td valign="top">(Element keys from Apple Mfi Gamepad definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="2" valign="top">This list only applies to unrecognized controllers. For recognized devices, such as Dual Shock 4, the following does not apply.</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/apple_mfi_gamepad/[product_name]</td>
|
|
<td valign="top"><p>Specific hardware target
|
|
<br />
|
|
Product name example:<br />
|
|
DUALSHOCK 4 Wireless Controller (matching case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/apple_mfi_gamepad/[product_category]</td>
|
|
<td valign="top"><p>Product category target<br />
|
|
<a href="https://developer.apple.com/documentation/gamecontroller/gcdevice/product_category_constants/#3878747">Product Category is a constant returned by Game Controller Framework.</a> Valid values will not be documented here.</p>
|
|
<p>(matching case)<br />
|
|
</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/apple_mfi_gamepad</td>
|
|
<td valign="top">Apple MFi fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>iOS/tvOS, Unity Input, Gamepad profile:</strong></td>
|
|
<td valign="top">(Element keys from Apple Mfi Gamepad definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/apple_mfi_gamepad/[product_name]</td>
|
|
<td valign="top"><p>Specific hardware target <br />
|
|
Product name example:<br />
|
|
DUALSHOCK 4 Wireless Controller (matching case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/apple_mfi_gamepad</td>
|
|
<td valign="top">Apple MFi fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>Android, Unity Input, Standardized Gamepad (if Support Unknown Gamepads enabled):</strong></td>
|
|
<td valign="top">(Element keys from Standardized Gamepad definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad/[product_name]</td>
|
|
<td valign="top"><p>Specific hardware target <br />
|
|
Product name example:<br />
|
|
DUALSHOCK 4 Wireless Controller (matching case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad</td>
|
|
<td valign="top">Standardized Gamepad fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>Linux, Unity Input, Pre-Configured Gamepad:</strong></td>
|
|
<td valign="top">(Element keys from Unity Preconfigured Controller definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/unity_linux_preconfigured_gamepad/[product_name]</td>
|
|
<td valign="top"><p>Specific hardware target <br />
|
|
Product name example:<br />
|
|
DUALSHOCK 4 Wireless Controller (matching case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/unity_linux_preconfigured_gamepad</td>
|
|
<td valign="top">Unity Pre-Configured Gamepad fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>WebGL, Native, unknown, Gamepad profile:</strong></td>
|
|
<td valign="top">(Element keys from Standardized Gamepad definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad/[vendor_id_hex:product_id_hex]</td>
|
|
<td valign="top">Specific hardware target<br />
|
|
Vendor / Product Id example:<br />
|
|
045e:0202 (lower case)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad/[product_name]</td>
|
|
<td valign="top"><p>Specific hardware target <br />
|
|
Product name example:<br />
|
|
DUALSHOCK 4 Wireless Controller (matching case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad</td>
|
|
<td valign="top">Standardized Gamepad fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p> </p>
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
|
<tr>
|
|
<td valign="top"><strong>SDL2, unknown, Gamepad profile:</strong></td>
|
|
<td valign="top">(Element keys from Standardized Gamepad definition)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad/[vendor_id_hex:product_id_hex]</td>
|
|
<td valign="top">Specific hardware target<br />
|
|
Vendor / Product Id example:<br />
|
|
045e:0202 (lower case)</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad/[product_name]</td>
|
|
<td valign="top"><p>Specific hardware target <br />
|
|
Product name example:<br />
|
|
DUALSHOCK 4 Wireless Controller (matching case)</p></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">controller/standardized_gamepad</td>
|
|
<td valign="top">Standardized Gamepad fallback</td>
|
|
</tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<p> </p>
|
|
<div class="bottom-pager clearfix">
|
|
<a class="back-button" href="Documentation.html" title="Actions"><span class="button-img"></span>Documentation</a></div>
|
|
<!-- InstanceEndEditable -->
|
|
</div>
|
|
|
|
</div>
|
|
<div class="footer clearfix">
|
|
<p class="left">Copyright ©2014-2021 <a href="http://guavaman.com" title="Guavaman Enterprises">Guavaman Enterprises</a>. All rights reserved. No materials may be reproduced without permission.</p>
|
|
<p class="right"><a href="http://guavaman.com/projects/rewired" title="Return to Rewired Website">Return to Rewired Website</a></p>
|
|
</div>
|
|
<!-- end .content --></div>
|
|
<!-- end .container --></div>
|
|
|
|
|
|
</body>
|
|
<!-- InstanceEnd --></html>
|