283 lines
20 KiB
HTML
283 lines
20 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 | Examples</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" -->Examples
|
|
<!-- InstanceEndEditable -->
|
|
</h1>
|
|
|
|
<!-- InstanceBeginEditable name="MainBody" -->
|
|
<p>All examples can be found in the Rewired/Examples folder. You should use these examples to learn how to work with the more advanced features of Rewired. More examples will be added in future updates.</p>
|
|
<ul>
|
|
<li><a href="#simple-control-remapping">Simple Control Remapping</a></li>
|
|
<li><a href="#simple-combined-keyboard-mouse-remapping">Simple Combined Keyboard Mouse Remapping</a></li>
|
|
<li><a href="#control-remapping-1">Control Remapping 1</a></li>
|
|
<li><a href="#custom-controllers-touch">Custom Controllers Touch</a></li>
|
|
<li><a href="#custom-controllers-tilt">Custom Controllers Tilt</a></li>
|
|
<li><a href="#custom-platform">Custom Platform</a></li>
|
|
<li><a href="#eight-players">Eight Players</a></li>
|
|
<li><a href="#fallback-joystick-identification">Fallback Joystick Identification</a></li>
|
|
<li><a href="#press-start-to-join">Press Start To Join</a></li>
|
|
<li><a href="#press-any-button-to-join">Press Any Button to Join</a></li>
|
|
<li><a href="#touch-controls-1">Touch Controls 1</a></li>
|
|
<li><a href="#touch-buttons-1">Touch Buttons 1</a></li>
|
|
<li><a href="#touch-joysticks-1">Touch Joysticks 1</a></li>
|
|
<li><a href="#gamepad-template-ui">Gamepad Template UI</a></li>
|
|
<li><a href="#player-mouse-sprite">Player Mouse Sprite</a></li>
|
|
<li><a href="#player-mouse-unity-ui">Player Mouse Unity UI</a></li>
|
|
<li><a href="#dualshock-4-special-features">DualShock 4 Special Features</a></li>
|
|
</ul>
|
|
<hr />
|
|
<h3><a name="simple-control-remapping" id="simple-control-remapping"></a>Simple Control Remapping</h3>
|
|
<p>(Included for Unity 5.0+)</p>
|
|
<p>NOTE: Rewired includes <a href="ControlMapper.html">Control Mapper</a>, a complete, configurable, responsive Unity UI-based control remapping system which can be used directly in your games. You can use it instead of writing your own remapping screen.</p>
|
|
<p>This is a very basic example of control remapping using the <a href="InputMapper.html">InputMapper</a> class. This example only supports 1 Player, 1 Joystick, 1 Controller Map, and 1 mapping per Action, per controller type. No UI windows are used and conflict checking is handled automatically by InputMapper to keep this example small and focused.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="simple-combined-keyboard-mouse-remapping" id="simple-combined-keyboard-mouse-remapping"></a>Simple Combined Keyboard Mouse Remapping</h3>
|
|
<p>(Included for Unity 5.0+)</p>
|
|
<p>NOTE: Rewired includes <a href="ControlMapper.html">Control Mapper</a>, a complete, configurable, responsive Unity UI-based control remapping system which can be used directly in your games. You can use it instead of writing your own remapping screen.</p>
|
|
<p>This is a very basic example of control remapping using the <a href="InputMapper.html">InputMapper</a> class to combine keyboard and mouse bindings into a single column. This is not how
|
|
Rewired is intended to work, but because some developers want to present it this way, this example has been provided.<br />
|
|
<br />
|
|
This example only supports 1 Player, 1 mapping per Action, and only supports keyboard and mouse input. This example is exclusively meant to illustrate how to use multiple Input Mappers to poll for input on multiple input devices simultaneously. It also illustrates how to handle replacement assignments across controller types and Controller Maps.<br />
|
|
<br />
|
|
No UI windows are used and conflict checking is handled automatically by InputMapper to keep this example small and focused.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="controller-remapping-1" id="dll-not-found-xinput"></a><a name="control-remapping-1" id="control-remapping-1"></a>Control Remapping 1</h3>
|
|
<p>NOTE: Rewired includes <a href="ControlMapper.html">Control Mapper</a>, a complete, configurable, responsive Unity UI-based control remapping system which can be used directly in your games. You can use it instead of writing your own remapping screen.</p>
|
|
<p>This example demonstrates how to create a controller remapping screen using legacy Unity's GUI system. The demo shows examples of:</p>
|
|
<ul>
|
|
<li>Assigning controllers to players</li>
|
|
<li>Mapping actions to controller, keyboard, and mouse elements</li>
|
|
<li>Conflict checking during element assignment</li>
|
|
<li>Using Map Categories and Action Categories to filter actions shown to user</li>
|
|
<li>Calibrating controller axes</li>
|
|
<li>Saving and loading controller maps, input behaviors, and calibration maps</li>
|
|
<li>Joystick identification for Unity input fallback platforms</li>
|
|
</ul>
|
|
<p>The example is not meant to be a finished, drop-in controller remapping screen. (If you're looking for that, use <a href="ControlMapper.html">Control Mapper</a>.) Many games may not need such a complex setup, and you'll very likely want to replace Unity's legacy GUI with nGUI, Unity's new UI, or another GUI system. You can use this example to learn how to implement each aspect and customize it for your game's needs.</p>
|
|
<p>For a simpler example, see <a href="#simple-control-remapping">Simple Control Remapping.</a></p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="custom-controllers-touch" id="custom-controllers-touch"></a>Custom Controllers Touch</h3>
|
|
<p>Note: Rewired now includes Touch Controls which can be used directly in your game. See <a href="TouchControls.html">Touch Controls</a> for more information.</p>
|
|
<p>This example shows how to implement Custom Controllers, one possible use of which is on-screen touch controllers. The demo is not meant to be a drop-in touch controller. Use the sample code to learn how to work with Custom Controllers.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="custom-controllers-tilt" id="custom-controllers-tilt"></a>Custom Controllers Tilt</h3>
|
|
<p>Note: Rewired now includes a Tilt Control which can be used directly in your game. See <a href="ComponentControls.html#tilt-control">Component Controls - Tilt Control</a> for more information.</p>
|
|
<p>This example shows how to handle basic tilt control on a mobile device using a Custom Controller. </p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="custom-platform" id="custom-platform"></a>Custom Platform</h3>
|
|
<p>(Included for Unity 5.0+)</p>
|
|
<p>This example shows how to add support for platforms that are not natively supported by Rewired. This is an advanced topic and requires expert knowledge in C#.</p>
|
|
<p><a href="CustomPlatforms.html">See the documentation on this topic.</a></p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="eight-players" id="eight-players"></a>Eight Players</h3>
|
|
<p>This example shows how to create basic joystick controls for 8 players and how to get input.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="fallback-joystick-identification" id="fallback-joystick-identification"></a>Fallback Joystick Identification</h3>
|
|
<p>This example shows how you identify which joystick is which using Unity's input system as the input source on Windows. See <a href="HowTos.html#identifying-joysticks-windows-fallback-or-webplayer">Identifying joysticks on Windows fallback or Windows Webplayer platforms</a> for more information.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="press-start-to-join" id="press-start-to-join"></a>Press Start To Join</h3>
|
|
<p>This example shows one possible implementation of a "Press Start to Join" joystick assignment system. This is based on <a href="HowTos.html#press-start-to-join-method-1">the example shown here under Method 1</a>.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><a name="press-any-button-to-join" id="press-any-button-to-join"></a>Press Any Button To Join</h3>
|
|
<p>This example shows one possible implementation of a "Press Any Button to Join" joystick assignment system. This is based on <a href="HowTos.html#press-start-to-join-method-2">the example shown here under Method 2</a>.</p>
|
|
<p> </p>
|
|
<hr />
|
|
<h3><img src="files/images/examples_touchcontrols1.png" alt="Touch Controls 1" class="right" /><a name="touch-controls-1" id="touch-controls-1"></a>Touch Controls 1</h3>
|
|
<p>This example shows a working touch controller setup including a Touch Joystick, Touch Button, Touch Pad, Touch Region, and a Tilt Control. See <a href="TouchControls.html">Touch Controls</a> for more information on touch controls and <a href="ComponentControls.html#tilt-control">Component Controls - Tilt Control</a> for more information on tilt control.</p>
|
|
<p>Example files are located in Rewired/Extras/TouchControls/Examples.</p>
|
|
<p> </p>
|
|
<hr class="clear" />
|
|
<h3><img src="files/images/examples_touchbuttons1.png" alt="Touch Buttons 1" class="right" /><a name="touch-buttons-1" id="touch-buttons-1"></a>Touch Buttons 1</h3>
|
|
<p>This example shows various configuration options of Touch Buttons. See <a href="TouchControls.html">Touch Controls</a> for more information on touch controls and <a href="ComponentControls.html#tilt-control">Component Controls - Tilt Control</a> for more information on tilt control.</p>
|
|
<p>Example files are located in Rewired/Extras/TouchControls/Examples.</p>
|
|
<hr class="clear" />
|
|
<h3><a name="touch-joysticks-1" id="touch-joysticks-1"></a>Touch Joysticks 1</h3>
|
|
<p>This example shows various Touch Joysticks. See <a href="TouchControls.html">Touch Controls</a> for more information on touch controls.</p>
|
|
<p>Example files are located in Rewired/Extras/TouchControls/Examples.</p>
|
|
<p> </p>
|
|
<hr class="clear" />
|
|
<h3><img src="files/images/examples_gamepadtemplateui.png" alt="Gamepad Template UI" class="right" /><a name="gamepad-template-ui" id="gamepad-template-ui"></a>Gamepad Template UI</h3>
|
|
<p>(Included for Unity 5.0+)</p>
|
|
<p>This example shows how determine which Controller Template elements correspond to mapped Actions in a Player, both those that are currently active and those that are mapped. These concepts can be used to display a Controller Template based mapping UI, display Controller Template element names / glyphs instead of Controller-specific element names / glyphs, etc. The same concepts can be used to display help UI using Controller Template elements instead of Controller-specific elements.</p>
|
|
<p>This example is NOT meant to be modified and used in your game. It is only intended to teach the API.</p>
|
|
<p> </p>
|
|
<hr class="clear" />
|
|
<h3><img src="files/images/examples_playermousesprite.png" alt="Gamepad Template UI" class="right" /><a name="player-mouse-sprite" id="player-mouse-sprite"></a>Player Mouse Sprite</h3>
|
|
<p>(Included for Unity 5.0+)</p>
|
|
<p>This example shows how to use a <a href="PlayerControllers.html#player-mouse">Player Mouse</a> through scripting to control as Sprite mouse pointer using any input device.</p>
|
|
<hr class="clear" />
|
|
<h3><img src="files/images/examples_playermouseunityui.png" alt="Gamepad Template UI" class="right" /><a name="player-mouse-unity-ui" id="player-mouse-unity-ui"></a>Player Mouse Unity UI</h3>
|
|
<p>(Included for Unity 5.0+)</p>
|
|
<p>This example shows how to use <a href="PlayerControllers.html#player-mouse">Player Mouse</a> components and the <a href="RewiredStandaloneInputModule.html">Rewired Standalone Input Module</a> to control 4 mouse pointers using any input device to interact with Unity UI.</p>
|
|
<hr class="clear" />
|
|
<h3><img src="files/images/examples_dualshock4specialfeatures.png" alt="Gamepad Template UI" class="right" /><a name="dualshock-4-special-features" id="dualshock-4-special-features"></a>DualShock 4 Special Features</h3>
|
|
<p>This example shows how to access the special features on the Dual Shock 4.</p>
|
|
<p> </p>
|
|
<div class="bottom-pager clearfix">
|
|
<a class="back-button" href="Documentation.html" title="Documentation"><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>
|