private void UpdateAdapter(Component c) { UdonBehaviour u = (UdonBehaviour)c; u.SetProgramVariable("local_bool", local_bool); u.SendCustomEvent("SetAdapterBool"); u.SetProgramVariable("local_float", local_float); u.SendCustomEvent("SetAdapterFloat"); }
void SendEvent(Handler eventSource, string eventName, string eventInfo) { if (EventListener) { EventListener.SetProgramVariable(nameof(ManagerListener.EXUR_EventSource), eventSource); EventListener.SetProgramVariable(nameof(ManagerListener.EXUR_EventName), eventName); EventListener.SetProgramVariable(nameof(ManagerListener.EXUR_EventAdditionalInfo), eventInfo); EventListener.SendCustomEvent(nameof(ManagerListener.EXUR_ReceiveEvent)); // TODO read variable to check variable exists in user program as kind debug mode (?) } }
void Interact() { if (Networking.IsOwner(boneposition.gameObject)) { bool track = (bool)boneposition.GetProgramVariable("track"); boneposition.SetProgramVariable("track", !track); } else { Networking.SetOwner(PlayerApiref, boneposition.gameObject); boneposition.SetProgramVariable("localwait", true); } }
private void Update() { if (PlayerApiref != null) { if (state) { Vector3 player = PlayerApiref.GetPosition(); if (Vector3.Distance(player, teleport_entry.position) < teleport_radius) { if (twoway_ref != null) { twoway_ref.SetProgramVariable("state", false); } PlayerApiref.TeleportTo(teleport_receiver.position, teleport_receiver.rotation); } } else { Vector3 player = PlayerApiref.GetPosition(); if (Vector3.Distance(player, teleport_entry.position) > teleport_radius) { state = true; } } } }
void ProcessPayload() { Component[] receiverComponents = transform.parent.GetComponents(typeof(UdonBehaviour)); int componentIndex = System.Int32.Parse((string)EVENT_ARRAY.GetValue(2)); if (componentIndex < receiverComponents.GetLowerBound(0) || componentIndex > receiverComponents.GetUpperBound(0)) { Debug.Log("[SE_Handler] Error: Component index " + componentIndex + " is out of bounds"); return; } UdonBehaviour receiverUdon = (UdonBehaviour)receiverComponents.GetValue(componentIndex); if (receiverUdon == null) { Debug.Log("[SE_Handler] Error: Could not access UdonBehaviour at index " + componentIndex); return; } if (EVENT_ARRAY.Length == 6) { string parametersString = (string)EVENT_ARRAY.GetValue(5); string[] parametersArray = parametersString.Split('|'); receiverUdon.SetProgramVariable("PARAMS", parametersArray); } string udonEventName = (string)EVENT_ARRAY.GetValue(4); receiverUdon.SendCustomEvent(udonEventName); }
void Start() { _EventManger = (UdonBehaviour)GameObject.Find("[SE_Manager]").GetComponent(typeof(UdonBehaviour)); UdonBehaviour master = (UdonBehaviour)transform.parent.GetComponent(typeof(UdonBehaviour)); master.SetProgramVariable("EventHandler", this); }
private void ShowVariableEditor(UdonBehaviour udonBehaviour) { expandVariableEditor_ = EditorGUILayout.Foldout(expandVariableEditor_, "Edit Public Variables", true); if (!expandVariableEditor_) { return; } var program = udonBehaviour.programSource; if (!(program is UdonProgramAsset programAsset)) { return; } var publicVariables = udonBehaviour.publicVariables; foreach (var varName in publicVariables.VariableSymbols) { publicVariables.TryGetVariableType(varName, out Type varType); object value = udonBehaviour.GetProgramVariable(varName); object[] parameters = { varName, value, varType, false, true }; var res = DrawPropertyMethod.Invoke(programAsset, parameters); if ((bool)parameters[3]) { udonBehaviour.SetProgramVariable(varName, res); } } }
public void SetBool() { if (udonBehaviour) { udonBehaviour.SetProgramVariable(variableName, value); if (UpdateMethod != string.Empty) { udonBehaviour.SendCustomEvent(UpdateMethod); } } if (toggle) { if (toggle.isOn != value) { toggleInitialize = false; toggle.isOn = value; toggleInitialize = true; } } if (display) { display.text = value.ToString(); } }
void GetEmitter() { if (LocalPlayerApi != null) { if (LocalPlayerApi.isMaster) { UdonBehaviour emitterUdon = (UdonBehaviour)Emitters.transform.GetChild(0).GetComponent(typeof(UdonBehaviour)); LocallyOwnedEmitter = emitterUdon; return; } else { int emitterCount = Emitters.transform.childCount; for (int i = 1; i < emitterCount; i++) { UdonBehaviour emitterUdon = (UdonBehaviour)Emitters.transform.GetChild(i).GetComponent(typeof(UdonBehaviour)); if (Networking.GetOwner(emitterUdon.gameObject).isMaster) { Networking.SetOwner(LocalPlayerApi, emitterUdon.gameObject); LocallyOwnedEmitter = emitterUdon; return; } } } } else { UdonBehaviour emitter = (UdonBehaviour)Emitters.transform.GetChild(0).GetComponent(typeof(UdonBehaviour)); emitter.SetProgramVariable("Owner", "UNITY_EDITOR"); LocallyOwnedEmitter = emitter; return; } }
public void SetInt() { if (udonBehaviour) { udonBehaviour.SetProgramVariable(variableName, value); if (UpdateMethod != string.Empty) { udonBehaviour.SendCustomEvent(UpdateMethod); } } if (slider) { if (slider.value != value) { sliderInitialize = false; slider.value = value; sliderInitialize = true; } } if (display) { display.text = value.ToString(); } }
void CheckOutbox() { if (!string.IsNullOrEmpty(EventOutbox)) { _EventManger.SetProgramVariable("EVENT", EventOutbox); EventOutbox = string.Empty; } }
void SendCallback(string eventName) { debug("SendCallback " + eventName); for (int i = 0; i < eventListeners.Length; i++) { var l = (UdonBehaviour)eventListeners[i]; if (l != this) { l.SendCustomEvent(eventName); } } if (aggregatedListener) { // NOTE: currently CustomEvent doesn't have argument. (VRCSDK3-UDON-2020.04.25.13.00) aggregatedListener.SetProgramVariable("EXUR_EventSource", this); aggregatedListener.SetProgramVariable("EXUR_EventName", eventName); aggregatedListener.SetProgramVariable("EXUR_EventAdditionalInfo", null); aggregatedListener.SendCustomEvent("EXUR_ReceiveEvent"); } }
public void Deny() { if (denyBehaviour != null && denyMethod != null) { if (denyParam != null) { denyBehaviour.SetProgramVariable(denyMethod + "_param0", denyParam); } denyBehaviour.SendCustomEvent(denyMethod); } animator.SetTrigger("close"); animator.ResetTrigger("close"); }
public void Accept() { if (acceptBehaviour != null && acceptMethod != null) { if (acceptParam != null) { acceptBehaviour.SetProgramVariable(acceptMethod + "_param0", acceptParam); } acceptBehaviour.SendCustomEvent(acceptMethod); } animator.SetTrigger("close"); animator.ResetTrigger("close"); }
void CheckEvent() { if (!string.IsNullOrEmpty(EVENT)) { if (LocallyOwnedEmitter == null) { Debug.Log("[SE_Manager] Error: Client owns no emitter"); return; } string eventString = Networking.GetServerTimeInMilliseconds().ToString() + ";" + EVENT; LocallyOwnedEmitter.SetProgramVariable("EVENT", eventString); EVENT = string.Empty; } }
#pragma warning restore CS0649 void TestSetGetProgramVar() { SetProgramVariable(nameof(_programVar), 5); tester.TestAssertion("SetProgramVariable local", _programVar == 5); tester.TestAssertion("GetProgramVariable local", (int)GetProgramVariable(nameof(_programVar)) == 5); // ReSharper disable once SuspiciousTypeConversion.Global UdonBehaviour selfUdonBehaviour = (UdonBehaviour)(Component)this; selfUdonBehaviour.SetProgramVariable(nameof(_programVar), 10); tester.TestAssertion("UdonBehaviour SetProgramVariable", _programVar == 10); tester.TestAssertion("UdonBehaviour GetProgramVariable", (int)selfUdonBehaviour.GetProgramVariable(nameof(_programVar)) == 10); }
public override void OnDeserialization() { var localPlayer = VRC.SDKBase.Networking.LocalPlayer; if (localPlayer.IsOwner(gameObject) || !Utilities.IsValid(targetBehaviour) || !Utilities.IsValid(localPlayer)) { return; } // refresh the variable in the target udon behaviour targetBehaviour.SetProgramVariable(targetVariable, syncedValue); if (!string.IsNullOrEmpty(targetDeserializeEvent)) { targetBehaviour.SendCustomEvent(targetDeserializeEvent); } UpdateOldValueAndTriggerChangeEvent(); }
void ProcessReceiver() { string receiverName = (string)EVENT_ARRAY.GetValue(1); GameObject receiverObject = GameObject.Find(receiverName); UdonBehaviour receiverUdon = (UdonBehaviour)receiverObject.GetComponent(typeof(UdonBehaviour)); if (receiverObject == null) { Debug.Log("[SE_Emitter] Error: No Receiver found called " + receiverName); return; } UdonBehaviour eventReceiverHandler = (UdonBehaviour)receiverUdon.GetProgramVariable("EventHandler"); if (eventReceiverHandler == null) { Debug.Log("[SE_Emitter] Error: No EventHandler found on target " + receiverObject.name); return; } eventReceiverHandler.SetProgramVariable("EventInbox", EVENT); }
public void UpdateSettings() { // Update labels gainLabel.text = "Gain: " + ((int)Remap(gainSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; trebleLabel.text = "Treble: " + ((int)Remap(trebleSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; bassLabel.text = "Bass: " + ((int)Remap(bassSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; // Update threshold0Slider.transform.localPosition = new Vector3(Remap(x1Slider.value / 2f, 0f, 1f, -349f, 349f), _initThreshold0SliderPosition.y, 0f); threshold1Slider.transform.localPosition = new Vector3(Remap((x1Slider.value + x2Slider.value) / 2f, 0f, 1f, -349f, 349f), _initThreshold1SliderPosition.y, 0f); threshold2Slider.transform.localPosition = new Vector3(Remap((x2Slider.value + x3Slider.value) / 2f, 0f, 1f, -349f, 349f), _initThreshold2SliderPosition.y, 0f); threshold3Slider.transform.localPosition = new Vector3(Remap((x3Slider.value + 1f) / 2f, 0f, 1f, -349f, 349f), _initThreshold3SliderPosition.y, 0f); // General settings audioLink.SetProgramVariable("gain", gainSlider.value); audioLink.SetProgramVariable("treble", trebleSlider.value); audioLink.SetProgramVariable("bass", bassSlider.value); audioLink.SetProgramVariable("fadeLength", fadeLengthSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); // Crossover settings float[] audioBands = (float[])audioLink.GetProgramVariable("audioBands"); audioBands[1] = x1Slider.value; audioBands[2] = x2Slider.value; audioBands[3] = x3Slider.value; audioLink.SetProgramVariable("audioBands", audioBands); audioSpectrumDisplay.SetFloatArray("_AudioBands", audioBands); float[] audioThresholds = (float[])audioLink.GetProgramVariable("audioThresholds"); audioThresholds[0] = threshold0Slider.value; audioThresholds[1] = threshold1Slider.value; audioThresholds[2] = threshold2Slider.value; audioThresholds[3] = threshold3Slider.value; audioLink.SetProgramVariable("audioThresholds", audioThresholds); audioSpectrumDisplay.SetFloatArray("_AudioThresholds", audioThresholds); audioLink.SendCustomEvent("UpdateSettings"); }
// ReSharper disable once InconsistentNaming private void CLR() { Log("Passcode CLEAR!"); internalKeypadDisplay.text = translationPasscode; foreach (var door in _doors) { if (door != gameObject) { door.SetActive(hideDoorOnGranted); } } if (programDenied != null) { programClosed.SetProgramVariable("keypadCode", _buffer); programClosed.SendCustomEvent("keypadClosed"); } _buffer = ""; }
void Start() { if (DS_Manager == null) { DS_Manager = GameObject.Find("[DS_Manager]").GetComponent <DelayServiceManager>(); } if (DS_Manager == null) { Debug.LogError("[DS_Handler]: Could not find DelayService Manager!"); return; } UdonBehaviour parentUdon = (UdonBehaviour)transform.parent.gameObject.GetComponent(typeof(UdonBehaviour)); if (parentUdon == null) { Debug.LogError("[DS_Handler]: Parent has no UdonBehaviour"); return; } parentUdon.SetProgramVariable("DS_Handler", this); }
private void Start() { spawnedObjects = new GameObject[objectCount]; for (int i = 0; i < objectCount; ++i) { GameObject instantiatedObject = Instantiate(sourcePrefab); UdonBehaviour behaviour = (UdonBehaviour)instantiatedObject.GetComponent(typeof(UdonBehaviour)); //Debug.Log(behaviour); behaviour.SetProgramVariable("displayName", "hello"); //Debug.Log(behaviour.GetProgramVariable("displayName")); instantiatedObject.SetActive(true); instantiatedObject.transform.parent = transform; //instantiatedObject.transform.position = Random.insideUnitSphere * 2f; //instantiatedObject.transform.rotation = Random.rotation; //instantiatedObject.transform.localScale *= Random.Range(0.2f, 1.5f); spawnedObjects[i] = instantiatedObject; } }
private void OnEnable() { //testFunc(4); //Debug.Log("hello! 15"); //foreach (var test in "hello") //{ // Debug.Log(test); //} //ushort testVal = 4f; //otherBehaviour.SendCustomEvent("PrintTest"); foreach (GameObject gameObj in spawnedObjects) { UdonBehaviour behaviour = (UdonBehaviour)gameObj.GetComponent(typeof(UdonBehaviour)); behaviour.SetProgramVariable("displayName", "hello"); } Debug.Log($"initialized on frame {Time.frameCount}"); }
public void UpdateSettings() { gainLabel.text = "Gain: " + ((int)Remap(gainSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; trebleLabel.text = "Treble: " + ((int)Remap(trebleSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; bassLabel.text = "Bass: " + ((int)Remap(bassSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; x1Label.text = "X1: " + ((int)x1Slider.value).ToString() + "hz"; x2Label.text = "X2: " + ((int)x2Slider.value).ToString() + "hz"; x3Label.text = "X3: " + ((int)x3Slider.value).ToString() + "hz"; audioLink.SetProgramVariable("gain", gainSlider.value); audioLink.SetProgramVariable("treble", trebleSlider.value); audioLink.SetProgramVariable("bass", bassSlider.value); audioLink.SetProgramVariable("fadeLength", fadeLengthSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); float[] spectrumBands = (float[])audioLink.GetProgramVariable("spectrumBands"); spectrumBands[1] = x1Slider.value; spectrumBands[2] = x2Slider.value; spectrumBands[3] = x3Slider.value; audioLink.SetProgramVariable("spectrumBands", spectrumBands); audioLink.SendCustomEvent("UpdateSettings"); }
public void validatePasscode() { inputProgram.resetInput(); int plength = passcodes.Length; // no code, just exit and reset display if (string.IsNullOrEmpty(attemptedPasscode)) { Debug.Log("Keypad OK: Empty string, resetting..."); displayProgram.resetDisplay(); return; } bool codeGranted = false; for (int i = 0; i < plength; i++) { if (attemptedPasscode == passcodes[i]) { Debug.Log("Keypad code: " + attemptedPasscode + " success"); codeGranted = true; displayProgram.text = grantedText; displayProgram.printText(); int dlength = doorObjects.Length - 1; // make sure an object exists for this current interation, if not just ignore it if (dlength >= i) { // not the settings obj, and not null! good! if ((doorObjects[i] != settingsObj) && (doorObjects[i] != null)) { // make sure active bool exists for this object if ((setActiveBools.Length - 1) >= i) { Debug.Log("Keypad granted: " + doorObjects[i].name + ".setActive(" + setActiveBools[i] + ")"); doorObjects[i].SetActive(setActiveBools[i]); } else { // default behavior Debug.Log("Keypad granted: " + doorObjects[i].name + ".setActive(false)"); doorObjects[i].SetActive(false); } } } if (programGranted != null) { // in the script, you can know which code was used to differentiate between multiple codes programGranted.SetProgramVariable("code", attemptedPasscode); programGranted.SendCustomEvent("keypadGranted"); } break; } } // no matches at all if (!codeGranted) { Debug.Log("Keypad: code " + attemptedPasscode + " denied"); // whether to make changes to active state of all objects if passcode doesn't go through // This can have the effect of disabling/enabling all active objects when we press OK if (changeActiveOnFail) { for (int i = 0; i < doorObjects.Length; i++) { // not the settings obj, and not null! good! if ((doorObjects[i] != settingsObj) && (doorObjects[i] != null)) { // make sure active bool exists for this object if ((setActiveBools.Length - 1) >= i) { Debug.Log("Keypad denied: " + doorObjects[i].name + ".setActive(" + !setActiveBools[i] + ")"); doorObjects[i].SetActive(!setActiveBools[i]); } else { // default behavior Debug.Log("Keypad denied: " + doorObjects[i].name + ".setActive(true)"); doorObjects[i].SetActive(true); } } } } displayProgram.text = deniedText; displayProgram.printText(); if (programDenied != null) { // in the script, you can know which code was used to differentiate between multiple codes programDenied.SetProgramVariable("code", attemptedPasscode); programDenied.SendCustomEvent("keypadDenied"); } } }
// ReSharper disable once InconsistentNaming private void OK() { var isOnAllow = false; var isOnDeny = false; var username = Networking.LocalPlayer == null ? "UnityEditor" : Networking.LocalPlayer.displayName; // Check if user is on allow list foreach (var entry in allowList) { if (entry == username) { isOnAllow = true; } } // Check if user is on deny list foreach (var entry in denyList) { if (entry == username) { isOnDeny = true; } } var isCorrect = false; GameObject correctDoor = null; for (var i = 0; i != _solutions.Length; i++) { if (_solutions[i] != _buffer) { continue; } isCorrect = true; if (i < _doors.Length) { correctDoor = _doors[i]; } } // Check if pass is correct and not on deny, or if is on allow list. if ((isCorrect && !isOnDeny) || isOnAllow) { Log(isOnAllow ? "GRANTED through allow list!" : "Passcode GRANTED!"); internalKeypadDisplay.text = translationGranted; foreach (var door in _doors) { if (door == gameObject) { continue; } if (additionalKeySeparation) { if (door == correctDoor) { door.SetActive(!hideDoorOnGranted); } else { door.SetActive(hideDoorOnGranted); } } else { door.SetActive(!hideDoorOnGranted); } } if (soundGranted != null) { soundGranted.Play(); } if (programGranted != null) { programGranted.SetProgramVariable("keypadCode", _buffer); programGranted.SendCustomEvent("keypadGranted"); } _buffer = ""; } else { // Do not announce to user that they are on deny list. Log("Passcode DENIED!"); internalKeypadDisplay.text = translationDenied; foreach (var door in _doors) { if (door == gameObject) { continue; } door.SetActive(hideDoorOnGranted); } if (soundDenied != null) { soundDenied.Play(); } if (programDenied != null) { programDenied.SetProgramVariable("keypadCode", _buffer); programDenied.SendCustomEvent("keypadDenied"); } _buffer = ""; } }
public void UpdateSettings() { // Update labels gainLabel.text = "Gain: " + ((int)Remap(gainSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; trebleLabel.text = "Treble: " + ((int)Remap(trebleSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; bassLabel.text = "Bass: " + ((int)Remap(bassSlider.value, 0f, 2f, 0f, 200f)).ToString() + "%"; // Update Sliders var anchor0 = new Vector2(x0Slider.value, 1f); var anchor1 = new Vector2(x1Slider.value, 1f); var anchor2 = new Vector2(x2Slider.value, 1f); var anchor3 = new Vector2(x3Slider.value, 1f); _threshold0Rect.anchorMin = anchor0; _threshold0Rect.anchorMax = anchor1; _threshold1Rect.anchorMin = anchor1; _threshold1Rect.anchorMax = anchor2; _threshold2Rect.anchorMin = anchor2; _threshold2Rect.anchorMax = anchor3; _threshold3Rect.anchorMin = anchor3; // threshold3Rect.anchorMax is a constant value. Skip // General settings audioLink.SetProgramVariable("gain", gainSlider.value); audioLink.SetProgramVariable("treble", trebleSlider.value); audioLink.SetProgramVariable("bass", bassSlider.value); audioLink.SetProgramVariable("fadeLength", fadeLengthSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); audioLink.SetProgramVariable("fadeExpFalloff", fadeExpFalloffSlider.value); // Crossover settings audioLink.SetProgramVariable("x0", x0Slider.value); audioLink.SetProgramVariable("x1", x1Slider.value); audioLink.SetProgramVariable("x2", x2Slider.value); audioLink.SetProgramVariable("x3", x3Slider.value); audioLink.SetProgramVariable("threshold0", threshold0Slider.value); audioLink.SetProgramVariable("threshold1", threshold1Slider.value); audioLink.SetProgramVariable("threshold2", threshold2Slider.value); audioLink.SetProgramVariable("threshold3", threshold3Slider.value); audioSpectrumDisplay.SetFloat("_X0", x0Slider.value); audioSpectrumDisplay.SetFloat("_X1", x1Slider.value); audioSpectrumDisplay.SetFloat("_X2", x2Slider.value); audioSpectrumDisplay.SetFloat("_X3", x3Slider.value); audioSpectrumDisplay.SetFloat("_Threshold0", threshold0Slider.value); audioSpectrumDisplay.SetFloat("_Threshold1", threshold1Slider.value); audioSpectrumDisplay.SetFloat("_Threshold2", threshold2Slider.value); audioSpectrumDisplay.SetFloat("_Threshold3", threshold3Slider.value); audioLink.SendCustomEvent("UpdateSettings"); }
public void variableset() //set float to custom number { udonBehaviour.SetProgramVariable(variable_string, custom_num); updatevisual(custom_num.ToString("0.00")); }
public override void OnOwnershipTransferred() { behaviour.SetProgramVariable(playerObjectName, Networking.GetOwner(gameObject)); behaviour.SendCustomEvent(eventName); }
public void Handle(VRCPlayerApi player, object[] udonNetData) { //TODO: UdonSharp does not support custom classes currently, so the data is packed in object[] uint eventId = (uint)udonNetData[0]; byte packetType = (byte)udonNetData[1]; int targetPlayer = (int)udonNetData[2]; byte[] buffer = (byte[])udonNetData[3]; NetworkedUNPlayer self = GetLocalUNPlayer(); if ((packetType & PacketEnquiry) != 0) { Debug.Log(string.Format("[UdonNet] Protocol enquiry received from player {0} ({1}), sending version {2}", player.displayName, player.playerId, ProtocolVersion)); self.SendVersion(player.playerId); } else if ((packetType & PacketAcknowledgement) != 0) { uint targetEventId = self.BytesToUint32(buffer, 0); Debug.Log(string.Format("[UdonNet] Acknowledgement received from player {0} ({1}), clearing wait ack for event ID {2}", player.displayName, player.playerId, targetEventId)); bool suc = self.ClearWaitAck(targetEventId); if (!suc) { Debug.Log("[UdonNet] Clear wait ack not successful. Such event ID does not exist in wait ack list."); } } else { if (eventListeners != null) { for (int i = 0; i < eventListeners.Length; i++) { if (eventListeners[i] != null) //TODO: check instance type { Component[] insts = eventListeners[i].GetComponents(typeof(UdonBehaviour)); for (int j = 0; j < insts.Length; j++) { UdonBehaviour inst = (UdonBehaviour)insts[j]; inst.SetProgramVariable("_udonNetReceivedData", udonNetData); inst.SetProgramVariable("_udonNetFromPlayer", player); inst.SetProgramVariable("_udonNetTargetedPlayer", targetPlayer); if ((packetType & PacketDataTypeString) != 0) { string stringData = self.BytesToString(buffer, 0); inst.SetProgramVariable("_udonNetStringData", stringData); } if ((packetType & PacketTargetedPlayer) != 0) { inst.SendCustomEvent("OnUdonNetPlayerEvent"); } else { inst.SendCustomEvent("OnUdonNetBroadcastEvent"); } inst.SendCustomEvent("OnUdonNetEvent"); } } } } if ((packetType & PacketLossless) != 0) { self.SendAck(player.playerId, eventId); } } }