egangw
1
Hi all,
I’m a beginner in C#, and am running Unity VR Enabled Executables through my Vive Headset. I’m trying to incorporate more behaviors into my VR files, and am writing a very simple script to press down the Vive Controller Trigger and have my .obj (object) rotate with trigger held down.
My compiler gives me the same error twice :
Delegate “ClickedEventsHandler” Does not take ‘1’ Arguments.
Delegate “ClickedEventsHandler” Does not take ‘1’ Arguments.
Here is the script :
using UnityEngine;
using System.Collections;
public class Rotate : MonoBehaviour
{
SteamVR_TrackedController controller;
public float turnSpeed = 50f;
public float GetButtonDown;
public event ClickedEventHandler TriggerButtonDown;
void Update ()
{
if (TriggerButtonDown(Input.GetButtonDown));
transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);
if (!TriggerButtonDown(Input.GetButtonUp));
transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime * 0);
}
}
I know this is a very simple problem, but I would love to hear what I am doing wrong if anybody has some advice.
Many thanks!
I’m not sure as I can’t test if for myself and I’m not familiar with it but searching around I think you’re following this.
My best guess is that you need to “subscribe” (also known as “register”) to the event handler. Something like:
private void OnEnable()
{
_controller.TriggerClicked += TriggerEventHandler;
}
So you don’t use them directly. If this is not clear, read about event management.
OR
Delete that public event ClickedEventHandler TriggerButtonDown; line.