Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/// </copyright>

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

/// <summary>
Expand All @@ -29,6 +30,9 @@
/// </summary>
public class SampleButtonScript : OSVR.Unity.InterfaceBase
{
public UnityEvent OnPress;
public UnityEvent OnRelease;

void Start()
{
osvrInterface.RegisterCallback(handleButton);
Expand All @@ -37,5 +41,7 @@ void Start()
void handleButton(string path, bool state)
{
Debug.Log("Got button: " + path + " state is " + state);
if(state) OnPress.Invoke();
else OnRelease.Invoke();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/// </copyright>

using UnityEngine;
using UnityEngine.Events;
using System.Collections;

/// <summary>
Expand All @@ -27,6 +28,9 @@
[RequireComponent(typeof(OSVR.Unity.InterfaceGameObject))]
public class HandleButtonPress : MonoBehaviour
{
public UnityEvent OnPress;
public UnityEvent OnRelease;

public void Start()
{
gameObject.GetComponent<OSVR.Unity.InterfaceGameObject>().osvrInterface.RegisterCallback(handleButton);
Expand All @@ -35,5 +39,7 @@ public void Start()
public void handleButton(string path, bool state)
{
Debug.Log("Got button: " + path + " state is " + state);
if(state) OnPress.Invoke();
else OnRelease.Invoke();
}
}