Skip to content

Commit

Permalink
CHANGE: Rename SimpleController versions for better clarity.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rene Damm committed Apr 23, 2018
1 parent 1ad5bc7 commit e216c73
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -20,3 +20,7 @@ Packages/com.unity.inputsystem/build/**
Packages/com.unity.inputsystem/Documentation/ApiDocs/**
Packages/com.unity.inputsystem/.DS_Store
Packages/com.unity.inputsystem/.npmrc

Packages/com.unity.package-manager-doctools/
Packages/com.unity.package-manager-ui/

Expand Up @@ -4,7 +4,7 @@
using UnityEngine;

// Using simple actions with callbacks.
public class SimpleController_v3 : MonoBehaviour
public class SimpleController_UsingActions : MonoBehaviour
{
public float moveSpeed;
public float rotateSpeed;
Expand Down
File renamed without changes.
Expand Up @@ -3,7 +3,7 @@
using UnityEngine;

// Tapping event stream.
public class SimpleController_v2 : MonoBehaviour
public class SimpleController_UsingEvents : MonoBehaviour
{
public float moveSpeed;
public float rotateSpeed;
Expand Down
File renamed without changes.
Expand Up @@ -2,7 +2,7 @@
using UnityEngine;

// Using state of gamepad device directly.
public class SimpleController_v1 : MonoBehaviour
public class SimpleController_UsingState : MonoBehaviour
{
public float moveSpeed;
public float rotateSpeed;
Expand Down
File renamed without changes.
Expand Up @@ -6,6 +6,8 @@
using UnityEngine.Experimental.Input.Utilities;
using UnityEngine.Profiling;

////TODO: if activeTouches is called multiple times in a single frame, only update the array once

////TODO: add orientation

////TODO: look at how you can meaningfully use touches with actions
Expand Down
Expand Up @@ -23,11 +23,11 @@ public unsafe struct StateEvent : IInputEventTypeInfo
/// </summary>
[FieldOffset(InputEvent.kBaseEventSize)] public FourCC stateFormat;

[FieldOffset(InputEvent.kBaseEventSize + 4)] public fixed byte stateData[1]; // Variable-sized.
[FieldOffset(InputEvent.kBaseEventSize + sizeof(int))] public fixed byte stateData[1]; // Variable-sized.

public uint stateSizeInBytes
{
get { return baseEvent.sizeInBytes - (InputEvent.kBaseEventSize + 4); }
get { return baseEvent.sizeInBytes - (InputEvent.kBaseEventSize + sizeof(int)); }
}

public IntPtr state
Expand All @@ -49,7 +49,7 @@ public FourCC GetTypeStatic()
public static int GetEventSizeWithPayload<TState>()
where TState : struct
{
return UnsafeUtility.SizeOf<TState>() + 24;
return UnsafeUtility.SizeOf<TState>() + InputEvent.kBaseEventSize + sizeof(int);
}

public static StateEvent* From(InputEventPtr ptr)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -14,8 +14,8 @@ Issues are expected at this point. However, feel free to report what you find he
## How to Use This In Your Own Project

1. Copy the `Packages/com.unity.inputsystem/` folder to the `Packages` folder of your own project.
2. Open the player settings in the editor (`Edit >> Project Settings >> Player`) and change `Active Input Handling*` in the 'Configuration' section to either "Both" or "Input System (Preview). Note that the latter will disable support for the old system and thus render most APIs in `UnityEngine.Input` non-functional. This will also have impact on systems using the API (e.g. `UnityEngine.UI`).
2. Open the player settings in the editor (`Edit >> Project Settings >> Player`) and change `Active Input Handling*` in the 'Configuration' section to either "Both" or "Input System (Preview)". Note that the latter will disable support for the old system and thus render most APIs in `UnityEngine.Input` non-functional. This will also have impact on systems using the API (e.g. `UnityEngine.UI`).
3. Restart the editor.

When you open the input debugger now (`Windows >> Input Debugger`), you should see the available local devices listed in the debug view.
When you open the input debugger now (`Window >> Input Debugger`), you should see the available local devices listed in the debug view.

0 comments on commit e216c73

Please sign in to comment.