Skip to content

Commit b2afbda

Browse files
committed
feat(Interaction): add RequireComponents to grab and touch
Since InteractGrab and InteractTouch don't work unless certain components are a part of the controller, the RequireComponent attributes will make sure those components are there or automatically add them. They also keep required components from being removed in the Unity editor.
1 parent be64a8c commit b2afbda

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Assets/SteamVR_Unity_Toolkit/Scripts/VRTK_InteractGrab.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace VRTK
1616
using UnityEngine;
1717
using System.Collections;
1818

19+
[RequireComponent(typeof(VRTK_InteractTouch)), RequireComponent(typeof(VRTK_ControllerEvents))]
1920
public class VRTK_InteractGrab : MonoBehaviour
2021
{
2122
public Rigidbody controllerAttachPoint = null;

Assets/SteamVR_Unity_Toolkit/Scripts/VRTK_InteractTouch.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public struct ObjectInteractEventArgs
1818

1919
public delegate void ObjectInteractEventHandler(object sender, ObjectInteractEventArgs e);
2020

21+
[RequireComponent(typeof(VRTK_ControllerActions))]
2122
public class VRTK_InteractTouch : MonoBehaviour
2223
{
2324

0 commit comments

Comments
 (0)