Tanoda
EventPlayableBehaviour.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using UnityEngine;
10using UnityEngine.Playables;
11
12namespace Leap.Unity.Recording {
13
14 public class EventPlayableBehaviour : PlayableBehaviour {
15
16 public GameObject recipient;
17 public string message = "MyMethod";
18 public object argument;
19
20 public void FireEvent() {
21 if (recipient == null) {
22 Debug.LogError("Unable to fire event: Recipient is null.");
23 return;
24 }
25
26 if (argument == null) {
27 //Debug.Log("Target: " + recipient.name + "; Sending message: " + message);
28
29 if (Application.isPlaying) {
30 recipient.SendMessage(message);
31 }
32 }
33 else {
34 //Debug.Log("Target: " + recipient.name + "; Sending message: " + message
35 // + "with arg: " + argument);
36
37 if (Application.isPlaying) {
38 recipient.SendMessage(message, argument);
39 }
40 }
41 }
42
43 }
44
45}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19