From d25daf7c323552dcbd8777ee983bfdbb41e7a9b4 Mon Sep 17 00:00:00 2001 From: Guribo Date: Sat, 12 Jun 2021 13:15:45 +0200 Subject: [PATCH] feat: add libraries, add networking behaviours --- .gitignore | 2 + Graphs.meta | 8 + Graphs/HorizontalLookAt.asset | 295 +++++++++ Graphs/HorizontalLookAt.asset.meta | 8 + Prefabs.meta | 8 + Prefabs/ILookAtTheLocalPlayer.prefab | 150 +++++ Prefabs/ILookAtTheLocalPlayer.prefab.meta | 7 + Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab | 150 +++++ ...ILookAtTheLocalPlayerUdonGraph.prefab.meta | 7 + Prefabs/UdonCommon.prefab | 169 +++++ Prefabs/UdonCommon.prefab.meta | 7 + Scenes/Examples/EditorTesting.unity | 8 +- Scripts/Common.meta | 8 + Scripts/Common/Editor.meta | 8 + Scripts/Common/Editor/Networking.meta | 8 + .../Networking/OwnershipTransferEditor.cs | 18 + .../OwnershipTransferEditor.cs.meta | 11 + Scripts/Common/Editor/UdonCommonEditor.cs | 21 + .../Common/Editor/UdonCommonEditor.cs.meta | 11 + Scripts/Common/Editor/UdonDebugEditor.cs | 20 + Scripts/Common/Editor/UdonDebugEditor.cs.meta | 3 + Scripts/Common/Editor/UdonLibraryEditor.cs | 49 ++ .../Common/Editor/UdonLibraryEditor.cs.meta | 3 + Scripts/Common/Editor/UdonMathEditor.cs | 21 + Scripts/Common/Editor/UdonMathEditor.cs.meta | 11 + Scripts/Common/HorizontalLookAt.asset | 200 ++++++ Scripts/Common/HorizontalLookAt.asset.meta | 8 + Scripts/Common/HorizontalLookAt.cs | 42 ++ Scripts/Common/HorizontalLookAt.cs.meta | 11 + Scripts/Common/Networking.meta | 8 + Scripts/Common/Networking/OwnerOnly.asset | 115 ++++ .../Common/Networking/OwnerOnly.asset.meta | 8 + Scripts/Common/Networking/OwnerOnly.cs | 46 ++ Scripts/Common/Networking/OwnerOnly.cs.meta | 11 + .../Common/Networking/OwnershipTransfer.asset | 189 ++++++ .../Networking/OwnershipTransfer.asset.meta | 8 + .../Common/Networking/OwnershipTransfer.cs | 104 +++ .../Networking/OwnershipTransfer.cs.meta | 3 + Scripts/Common/Networking/SyncedInteger.asset | 606 ++++++++++++++++++ .../Networking/SyncedInteger.asset.meta | 8 + Scripts/Common/Networking/SyncedInteger.cs | 140 ++++ .../Common/Networking/SyncedInteger.cs.meta | 3 + .../Common/ReflectionProbeController.asset | 263 ++++++++ .../ReflectionProbeController.asset.meta | 8 + Scripts/Common/ReflectionProbeController.cs | 49 ++ .../Common/ReflectionProbeController.cs.meta | 11 + Scripts/Common/UdonCommon.asset | 52 ++ Scripts/Common/UdonCommon.asset.meta | 8 + Scripts/Common/UdonCommon.cs | 42 ++ Scripts/Common/UdonCommon.cs.meta | 11 + Scripts/Common/UdonDebug.asset | 52 ++ Scripts/Common/UdonDebug.asset.meta | 8 + Scripts/Common/UdonDebug.cs | 32 + Scripts/Common/UdonDebug.cs.meta | 11 + Scripts/Common/UdonMath.asset | 52 ++ Scripts/Common/UdonMath.asset.meta | 8 + Scripts/Common/UdonMath.cs | 99 +++ Scripts/Common/UdonMath.cs.meta | 11 + Scripts/PackageExporter.cs | 191 ++++++ Scripts/PackageExporter.cs.meta | 11 + Scripts/UdonUtilsPackageExporter.cs | 51 ++ Scripts/UdonUtilsPackageExporter.cs.meta | 11 + Version.txt | 1 + Version.txt.meta | 7 + 64 files changed, 3505 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 Graphs.meta create mode 100644 Graphs/HorizontalLookAt.asset create mode 100644 Graphs/HorizontalLookAt.asset.meta create mode 100644 Prefabs.meta create mode 100644 Prefabs/ILookAtTheLocalPlayer.prefab create mode 100644 Prefabs/ILookAtTheLocalPlayer.prefab.meta create mode 100644 Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab create mode 100644 Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab.meta create mode 100644 Prefabs/UdonCommon.prefab create mode 100644 Prefabs/UdonCommon.prefab.meta create mode 100644 Scripts/Common.meta create mode 100644 Scripts/Common/Editor.meta create mode 100644 Scripts/Common/Editor/Networking.meta create mode 100644 Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs create mode 100644 Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs.meta create mode 100644 Scripts/Common/Editor/UdonCommonEditor.cs create mode 100644 Scripts/Common/Editor/UdonCommonEditor.cs.meta create mode 100644 Scripts/Common/Editor/UdonDebugEditor.cs create mode 100644 Scripts/Common/Editor/UdonDebugEditor.cs.meta create mode 100644 Scripts/Common/Editor/UdonLibraryEditor.cs create mode 100644 Scripts/Common/Editor/UdonLibraryEditor.cs.meta create mode 100644 Scripts/Common/Editor/UdonMathEditor.cs create mode 100644 Scripts/Common/Editor/UdonMathEditor.cs.meta create mode 100644 Scripts/Common/HorizontalLookAt.asset create mode 100644 Scripts/Common/HorizontalLookAt.asset.meta create mode 100644 Scripts/Common/HorizontalLookAt.cs create mode 100644 Scripts/Common/HorizontalLookAt.cs.meta create mode 100644 Scripts/Common/Networking.meta create mode 100644 Scripts/Common/Networking/OwnerOnly.asset create mode 100644 Scripts/Common/Networking/OwnerOnly.asset.meta create mode 100644 Scripts/Common/Networking/OwnerOnly.cs create mode 100644 Scripts/Common/Networking/OwnerOnly.cs.meta create mode 100644 Scripts/Common/Networking/OwnershipTransfer.asset create mode 100644 Scripts/Common/Networking/OwnershipTransfer.asset.meta create mode 100644 Scripts/Common/Networking/OwnershipTransfer.cs create mode 100644 Scripts/Common/Networking/OwnershipTransfer.cs.meta create mode 100644 Scripts/Common/Networking/SyncedInteger.asset create mode 100644 Scripts/Common/Networking/SyncedInteger.asset.meta create mode 100644 Scripts/Common/Networking/SyncedInteger.cs create mode 100644 Scripts/Common/Networking/SyncedInteger.cs.meta create mode 100644 Scripts/Common/ReflectionProbeController.asset create mode 100644 Scripts/Common/ReflectionProbeController.asset.meta create mode 100644 Scripts/Common/ReflectionProbeController.cs create mode 100644 Scripts/Common/ReflectionProbeController.cs.meta create mode 100644 Scripts/Common/UdonCommon.asset create mode 100644 Scripts/Common/UdonCommon.asset.meta create mode 100644 Scripts/Common/UdonCommon.cs create mode 100644 Scripts/Common/UdonCommon.cs.meta create mode 100644 Scripts/Common/UdonDebug.asset create mode 100644 Scripts/Common/UdonDebug.asset.meta create mode 100644 Scripts/Common/UdonDebug.cs create mode 100644 Scripts/Common/UdonDebug.cs.meta create mode 100644 Scripts/Common/UdonMath.asset create mode 100644 Scripts/Common/UdonMath.asset.meta create mode 100644 Scripts/Common/UdonMath.cs create mode 100644 Scripts/Common/UdonMath.cs.meta create mode 100644 Scripts/PackageExporter.cs create mode 100644 Scripts/PackageExporter.cs.meta create mode 100644 Scripts/UdonUtilsPackageExporter.cs create mode 100644 Scripts/UdonUtilsPackageExporter.cs.meta create mode 100644 Version.txt create mode 100644 Version.txt.meta diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e0aa220 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/Releases/ +/Releases.meta diff --git a/Graphs.meta b/Graphs.meta new file mode 100644 index 0000000..24327ee --- /dev/null +++ b/Graphs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3638ed376c5a86d44a37588903294bf0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Graphs/HorizontalLookAt.asset b/Graphs/HorizontalLookAt.asset new file mode 100644 index 0000000..8c6813f --- /dev/null +++ b/Graphs/HorizontalLookAt.asset @@ -0,0 +1,295 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f11136daadff0b44ac2278a314682ab, type: 3} + m_Name: HorizontalLookAt + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: d6bdc5fdaa093bc4b8bf3c34220f70bd, + type: 2} + udonAssembly: ".data_start\r\n\r\n .export weight\r\n \r\n instance_0: + %VRCUdonUdonBehaviour, this\r\n symbolName_0: %SystemString, null\r\n value_0: + %SystemObject, null\r\n instance_1: %UnityEngineTransform, this\r\n object_0: + %SystemObject, null\r\n result_0: %SystemBoolean, null\r\n instance_2: %UnityEngineTransform, + this\r\n value_1: %UnityEngineQuaternion, null\r\n x_0: %SystemSingle, null\r\n + \ y_0: %SystemSingle, null\r\n z_0: %SystemSingle, null\r\n Vector3_0: + %UnityEngineVector3, null\r\n instance_3: %UnityEngineQuaternion, null\r\n + \ a_0: %UnityEngineQuaternion, null\r\n b_0: %UnityEngineQuaternion, null\r\n + \ t_0: %SystemSingle, null\r\n forward_0: %UnityEngineVector3, null\r\n Vector3_1: + %UnityEngineVector3, null\r\n Vector3_2: %UnityEngineVector3, null\r\n instance_4: + %UnityEngineTransform, this\r\n instance_5: %VRCSDKBaseVRCPlayerApi, null\r\n + \ weight: %SystemSingle, null\r\n _initialRotation: %UnityEngineQuaternion, + null\r\n\r\n.data_end\r\n\r\n.code_start\r\n\r\n .export _start\r\n \r\n + \ _start:\r\n \r\n PUSH, instance_1\r\n PUSH, value_0\r\n EXTERN, + \"UnityEngineTransform.__get_rotation__UnityEngineQuaternion\"\r\n PUSH, + instance_0\r\n PUSH, symbolName_0\r\n PUSH, value_0\r\n EXTERN, + \"VRCUdonCommonInterfacesIUdonEventReceiver.__SetProgramVariable__SystemString_SystemObject__SystemVoid\"\r\n + \ JUMP, 0xFFFFFFFC\r\n \r\n .export _update\r\n \r\n _update:\r\n + \ \r\n PUSH, object_0\r\n EXTERN, \"VRCSDKBaseNetworking.__get_LocalPlayer__VRCSDKBaseVRCPlayerApi\"\r\n + \ PUSH, object_0\r\n PUSH, result_0\r\n EXTERN, \"VRCSDKBaseUtilities.__IsValid__SystemObject__SystemBoolean\"\r\n + \ PUSH, result_0\r\n JUMP_IF_FALSE, 0x00000194\r\n PUSH, instance_4\r\n + \ PUSH, Vector3_1\r\n EXTERN, \"UnityEngineTransform.__get_position__UnityEngineVector3\"\r\n + \ PUSH, object_0\r\n PUSH, instance_5\r\n COPY\r\n PUSH, + object_0\r\n PUSH, Vector3_2\r\n EXTERN, \"VRCSDKBaseVRCPlayerApi.__GetPosition__UnityEngineVector3\"\r\n + \ PUSH, Vector3_1\r\n PUSH, Vector3_2\r\n PUSH, forward_0\r\n + \ EXTERN, \"UnityEngineVector3.__op_Subtraction__UnityEngineVector3_UnityEngineVector3__UnityEngineVector3\"\r\n + \ PUSH, forward_0\r\n PUSH, b_0\r\n EXTERN, \"UnityEngineQuaternion.__LookRotation__UnityEngineVector3__UnityEngineQuaternion\"\r\n + \ PUSH, _initialRotation\r\n PUSH, b_0\r\n PUSH, weight\r\n + \ PUSH, instance_3\r\n EXTERN, \"UnityEngineQuaternion.__Slerp__UnityEngineQuaternion_UnityEngineQuaternion_SystemSingle__UnityEngineQuaternion\"\r\n + \ PUSH, instance_3\r\n PUSH, Vector3_0\r\n EXTERN, \"UnityEngineQuaternion.__get_eulerAngles__UnityEngineVector3\"\r\n + \ PUSH, Vector3_0\r\n PUSH, y_0\r\n EXTERN, \"UnityEngineVector3.__get_y__SystemSingle\"\r\n + \ PUSH, x_0\r\n PUSH, y_0\r\n PUSH, z_0\r\n PUSH, value_1\r\n + \ EXTERN, \"UnityEngineQuaternion.__Euler__SystemSingle_SystemSingle_SystemSingle__UnityEngineQuaternion\"\r\n + \ PUSH, instance_2\r\n PUSH, value_1\r\n EXTERN, \"UnityEngineTransform.__set_rotation__UnityEngineQuaternion__SystemVoid\"\r\n + \ JUMP, 0x00000194\r\n JUMP, 0xFFFFFFFC\r\n \r\n\r\n.code_end\r\n" + assemblyError: + graphData: + name: + description: + nodes: + - fullName: Variable_SystemSingle + uid: e923e774-3a73-41f5-9bfd-58e34e6aa13b + position: {x: 0, y: 0} + nodeUIDs: + - + - + - + - + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|1 + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|weight + - unityObjectValue: {fileID: 0} + stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|True + - unityObjectValue: {fileID: 0} + stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|False + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|none + - fullName: Variable_UnityEngineQuaternion + uid: 0e0ff6b0-93a4-49ea-bc5d-d8a1def425e3 + position: {x: 0, y: 0} + nodeUIDs: + - + - + - + - + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|_initialRotation + - unityObjectValue: {fileID: 0} + stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|False + - unityObjectValue: {fileID: 0} + stringValue: System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|False + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|none + - fullName: Event_Start + uid: 2fd618ba-0e8e-4354-85ea-21d1eb1cd6e4 + position: {x: 237, y: 10.120003} + nodeUIDs: [] + flowUIDs: + - 863d8b39-795d-47f0-97ef-38332dfb396e + nodeValues: [] + - fullName: UnityEngineTransform.__get_rotation__UnityEngineQuaternion + uid: 71be00eb-4ebc-466c-8e62-d2346b5efa8d + position: {x: 366, y: 99.12} + nodeUIDs: + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: VRCUdonCommonInterfacesIUdonEventReceiver.__SetProgramVariable__SystemString_SystemObject__SystemVoid + uid: 863d8b39-795d-47f0-97ef-38332dfb396e + position: {x: 611, y: 10.120003} + nodeUIDs: + - + - + - 71be00eb-4ebc-466c-8e62-d2346b5efa8d|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|_initialRotation + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: Event_Update + uid: c3047606-35f4-4db7-925a-65891c080eea + position: {x: 237, y: 299.12} + nodeUIDs: [] + flowUIDs: + - dddd9e5c-9de3-4ce6-a504-eecad67a5b01 + nodeValues: [] + - fullName: UnityEngineTransform.__get_position__UnityEngineVector3 + uid: c1609de1-79b3-41f6-b104-da4653ab381e + position: {x: 447.31854, y: 449.35907} + nodeUIDs: + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: VRCSDKBaseNetworking.__get_LocalPlayer__VRCSDKBaseVRCPlayerApi + uid: a708fad7-7191-4583-a172-ce1b4aae4237 + position: {x: 231, y: 441.12} + nodeUIDs: [] + flowUIDs: [] + nodeValues: [] + - fullName: Is_Valid + uid: dddd9e5c-9de3-4ce6-a504-eecad67a5b01 + position: {x: 442, y: 301.12} + nodeUIDs: + - a708fad7-7191-4583-a172-ce1b4aae4237|0 + flowUIDs: + - 792ff194-644f-4481-9c40-464b58d476dc + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: UnityEngineVector3.__op_Subtraction__UnityEngineVector3_UnityEngineVector3__UnityEngineVector3 + uid: 71c60369-dc95-46ee-a076-85bbeeb34341 + position: {x: 665.31854, y: 470.35904} + nodeUIDs: + - c1609de1-79b3-41f6-b104-da4653ab381e|0 + - 8a27f689-3a13-4616-882d-dbe11684a773|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0} + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0} + - fullName: VRCSDKBaseVRCPlayerApi.__GetPosition__UnityEngineVector3 + uid: 8a27f689-3a13-4616-882d-dbe11684a773 + position: {x: 449.31854, y: 546.7591} + nodeUIDs: + - a708fad7-7191-4583-a172-ce1b4aae4237|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: UnityEngineQuaternion.__LookRotation__UnityEngineVector3__UnityEngineQuaternion + uid: 41ff8417-f605-4b2e-a773-dadabf686b0e + position: {x: 891.3185, y: 476.11905} + nodeUIDs: + - 71c60369-dc95-46ee-a076-85bbeeb34341|0 + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0} + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0} + - fullName: UnityEngineQuaternion.__Slerp__UnityEngineQuaternion_UnityEngineQuaternion_SystemSingle__UnityEngineQuaternion + uid: f9e11131-350c-4a7e-be01-ba48cced02b4 + position: {x: 1248.3185, y: 411.11908} + nodeUIDs: + - c0457fc3-0a3e-43b2-b542-6b25acfaaecd|0 + - 41ff8417-f605-4b2e-a773-dadabf686b0e|0 + - b6d37cc4-ccb6-4a47-b2af-4fd441095e7b|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0,"w":0.0} + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0,"w":0.0} + - unityObjectValue: {fileID: 0} + stringValue: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|0 + - fullName: Get_Variable + uid: b6d37cc4-ccb6-4a47-b2af-4fd441095e7b + position: {x: 975.31854, y: 582.2391} + nodeUIDs: + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|e923e774-3a73-41f5-9bfd-58e34e6aa13b + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: Get_Variable + uid: c0457fc3-0a3e-43b2-b542-6b25acfaaecd + position: {x: 895.3185, y: 379.99908} + nodeUIDs: + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|0e0ff6b0-93a4-49ea-bc5d-d8a1def425e3 + - unityObjectValue: {fileID: 0} + stringValue: + - fullName: UnityEngineQuaternion.__get_eulerAngles__UnityEngineVector3 + uid: 04842881-04bc-4f41-bd17-92754b9a5959 + position: {x: 1497.3186, y: 429.11905} + nodeUIDs: + - f9e11131-350c-4a7e-be01-ba48cced02b4|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0,"w":0.0} + - fullName: UnityEngineTransform.__set_rotation__UnityEngineQuaternion__SystemVoid + uid: 792ff194-644f-4481-9c40-464b58d476dc + position: {x: 2185.6965, y: 304.16284} + nodeUIDs: + - + - 699ad579-eca7-43b8-ace9-62020dc8eff2|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Quaternion, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0,"w":0.0} + - fullName: UnityEngineQuaternion.__Euler__SystemSingle_SystemSingle_SystemSingle__UnityEngineQuaternion + uid: 699ad579-eca7-43b8-ace9-62020dc8eff2 + position: {x: 1941.4781, y: 377.9635} + nodeUIDs: + - + - 29a0f821-190b-456d-9716-44d82f76bdba|0 + - + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|0 + - unityObjectValue: {fileID: 0} + stringValue: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|0 + - unityObjectValue: {fileID: 0} + stringValue: System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|0 + - fullName: UnityEngineVector3.__get_y__SystemSingle + uid: 29a0f821-190b-456d-9716-44d82f76bdba + position: {x: 1765.9839, y: 426.9353} + nodeUIDs: + - 04842881-04bc-4f41-bd17-92754b9a5959|0 + flowUIDs: [] + nodeValues: + - unityObjectValue: {fileID: 0} + stringValue: UnityEngine.Vector3, UnityEngine.CoreModule, Version=0.0.0.0, + Culture=neutral, PublicKeyToken=null|{"x":0.0,"y":0.0,"z":0.0} + updateOrder: 0 + graphElementData: + - type: 5 + uid: 9812095f-d089-45e4-b339-c14973bd58e9 + jsonData: '{"visible":true,"layout":{"serializedVersion":"2","x":10.0,"y":130.0,"width":200.0,"height":150.0}}' + viewTransform: + position: {x: 73.2903, y: 136.85036} + scale: 0.57175326 + version: 1.0.0 + showAssembly: 0 diff --git a/Graphs/HorizontalLookAt.asset.meta b/Graphs/HorizontalLookAt.asset.meta new file mode 100644 index 0000000..d88da8f --- /dev/null +++ b/Graphs/HorizontalLookAt.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 282ba712dfa27c246b44b2c9e30d749c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Prefabs.meta b/Prefabs.meta new file mode 100644 index 0000000..37861ef --- /dev/null +++ b/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: be5f3db055642d24d9af792c0daff386 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Prefabs/ILookAtTheLocalPlayer.prefab b/Prefabs/ILookAtTheLocalPlayer.prefab new file mode 100644 index 0000000..aab86de --- /dev/null +++ b/Prefabs/ILookAtTheLocalPlayer.prefab @@ -0,0 +1,150 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2269216540744754717 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2269216540744754719} + - component: {fileID: 2269216540744754718} + m_Layer: 0 + m_Name: ILookAtTheLocalPlayer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2269216540744754719 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2269216540744754717} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2269216541675983627} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2269216540744754718 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2269216540744754717} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 0 + Reliable: 0 + serializedProgramAsset: {fileID: 11400000, guid: b126f87a17287974a8e0af0ada790138, + type: 2} + programSource: {fileID: 11400000, guid: a37533707706cdc4ba5293865ef9c38c, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUoAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBTAGkAbgBnAGwAZQAsACAAbQBzAGMAbwByAGwAaQBiAF0AXQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAgAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABBgAAAHcAZQBpAGcAaAB0ACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAaQBuAGcAbABlACwAIABtAHMAYwBvAHIAbABpAGIAHwEFAAAAVgBhAGwAdQBlAAAAgD8HBQcFBwU= + publicVariablesUnityEngineObjects: [] + publicVariablesSerializationDataFormat: 0 +--- !u!1 &2269216541675983626 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2269216541675983627} + - component: {fileID: 2269216541675983630} + - component: {fileID: 2269216541675983629} + - component: {fileID: 2269216541675983628} + m_Layer: 0 + m_Name: ExampleCube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2269216541675983627 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2269216541675983626} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 2269216540744754719} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &2269216541675983630 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2269216541675983626} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &2269216541675983629 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2269216541675983626} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!65 &2269216541675983628 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2269216541675983626} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Prefabs/ILookAtTheLocalPlayer.prefab.meta b/Prefabs/ILookAtTheLocalPlayer.prefab.meta new file mode 100644 index 0000000..923e228 --- /dev/null +++ b/Prefabs/ILookAtTheLocalPlayer.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c37760ba6c479a640a62f1d11cba4560 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab b/Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab new file mode 100644 index 0000000..2f321c9 --- /dev/null +++ b/Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab @@ -0,0 +1,150 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &5887523046960514955 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5887523046960514953} + - component: {fileID: 2686884558796281000} + m_Layer: 0 + m_Name: ILookAtTheLocalPlayerUdonGraph + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5887523046960514953 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5887523046960514955} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 5887523047639904925} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2686884558796281000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5887523046960514955} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 1 + Reliable: 0 + serializedProgramAsset: {fileID: 11400000, guid: d6bdc5fdaa093bc4b8bf3c34220f70bd, + type: 2} + programSource: {fileID: 11400000, guid: 282ba712dfa27c246b44b2c9e30d749c, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgEAAAAAAAAAAi8CAAAAAUoAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBTAGkAbgBnAGwAZQAsACAAbQBzAGMAbwByAGwAaQBiAF0AXQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAgAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABBgAAAHcAZQBpAGcAaAB0ACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAaQBuAGcAbABlACwAIABtAHMAYwBvAHIAbABpAGIAHwEFAAAAVgBhAGwAdQBlAAAAgD8HBQcFBwU= + publicVariablesUnityEngineObjects: [] + publicVariablesSerializationDataFormat: 0 +--- !u!1 &5887523047639904924 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5887523047639904925} + - component: {fileID: 5887523047639904920} + - component: {fileID: 5887523047639904923} + - component: {fileID: 5887523047639904922} + m_Layer: 0 + m_Name: ExampleCube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5887523047639904925 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5887523047639904924} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 5887523046960514953} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &5887523047639904920 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5887523047639904924} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &5887523047639904923 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5887523047639904924} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 +--- !u!65 &5887523047639904922 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5887523047639904924} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab.meta b/Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab.meta new file mode 100644 index 0000000..1128a06 --- /dev/null +++ b/Prefabs/ILookAtTheLocalPlayerUdonGraph.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f1c4a76783eadf74bb0ec9e4e89cdc0c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Prefabs/UdonCommon.prefab b/Prefabs/UdonCommon.prefab new file mode 100644 index 0000000..67ce29e --- /dev/null +++ b/Prefabs/UdonCommon.prefab @@ -0,0 +1,169 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3605882566993856259 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2332087467844710116} + - component: {fileID: 6139366856658744666} + m_Layer: 0 + m_Name: Networking + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2332087467844710116 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3605882566993856259} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 8836536511599812955} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &6139366856658744666 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3605882566993856259} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 0 + Reliable: 0 + serializedProgramAsset: {fileID: 11400000, guid: c965fd3bcc7dce44eaf328e87588983f, + type: 2} + programSource: {fileID: 11400000, guid: 777efcf936ab8264b9f792163a8f4ae2, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgIAAAAAAAAAAi8CAAAAAVMAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AVQBkAG8AbgBCAGUAaABhAHYAaQBvAHUAcgAsACAAVgBSAEMALgBVAGQAbwBuAF0AXQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAgAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABCgAAAHUAZABvAG4AQwBvAG0AbQBvAG4AJwEEAAAAdAB5AHAAZQABIAAAAFYAUgBDAC4AVQBkAG8AbgAuAFUAZABvAG4AQgBlAGgAYQB2AGkAbwB1AHIALAAgAFYAUgBDAC4AVQBkAG8AbgALAQUAAABWAGEAbAB1AGUAAAAAAAcFAjACAAAAAwAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABCQAAAHUAZABvAG4ARABlAGIAdQBnACcBBAAAAHQAeQBwAGUAASAAAABWAFIAQwAuAFUAZABvAG4ALgBVAGQAbwBuAEIAZQBoAGEAdgBpAG8AdQByACwAIABWAFIAQwAuAFUAZABvAG4ACwEFAAAAVgBhAGwAdQBlAAEAAAAHBQcFBwU= + publicVariablesUnityEngineObjects: + - {fileID: 2633040723707340454} + - {fileID: 8836536511599812952} + publicVariablesSerializationDataFormat: 0 +--- !u!1 &8836536511599812901 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8836536511599812955} + - component: {fileID: 8836536511599812954} + - component: {fileID: 8836536511599812952} + - component: {fileID: 2633040723707340454} + m_Layer: 0 + m_Name: UdonCommon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 4294967295 + m_IsActive: 1 +--- !u!4 &8836536511599812955 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8836536511599812901} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 2332087467844710116} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8836536511599812954 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8836536511599812901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 0 + Reliable: 0 + serializedProgramAsset: {fileID: 11400000, guid: 5b10d8de98911b343bc4026f9301f605, + type: 2} + programSource: {fileID: 11400000, guid: e7ee04f28c429a6408a600a72eeede95, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgAAAAAAAAAABwUHBQ== + publicVariablesUnityEngineObjects: [] + publicVariablesSerializationDataFormat: 0 +--- !u!114 &8836536511599812952 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8836536511599812901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 0 + Reliable: 0 + serializedProgramAsset: {fileID: 11400000, guid: 38b8d3d02ad23bd468e0c49452e108cb, + type: 2} + programSource: {fileID: 11400000, guid: ccfba9ab8ff45f64c9539764aa13ec95, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgAAAAAAAAAABwUHBQ== + publicVariablesUnityEngineObjects: [] + publicVariablesSerializationDataFormat: 0 +--- !u!114 &2633040723707340454 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8836536511599812901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 45115577ef41a5b4ca741ed302693907, type: 3} + m_Name: + m_EditorClassIdentifier: + interactTextPlacement: {fileID: 0} + interactText: Use + interactTextGO: {fileID: 0} + proximity: 2 + SynchronizePosition: 0 + AllowCollisionOwnershipTransfer: 0 + Reliable: 0 + serializedProgramAsset: {fileID: 11400000, guid: 376aa8c882e940b498a22f9c3dc109e3, + type: 2} + programSource: {fileID: 11400000, guid: f1a80167fd5f061499c834bb971daf3b, type: 2} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgAAAAAAAAAABwUHBQ== + publicVariablesUnityEngineObjects: [] + publicVariablesSerializationDataFormat: 0 diff --git a/Prefabs/UdonCommon.prefab.meta b/Prefabs/UdonCommon.prefab.meta new file mode 100644 index 0000000..7202c45 --- /dev/null +++ b/Prefabs/UdonCommon.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e9285a00f7474c345bd781c6abf07ba9 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scenes/Examples/EditorTesting.unity b/Scenes/Examples/EditorTesting.unity index f3672e0..5726615 100644 --- a/Scenes/Examples/EditorTesting.unity +++ b/Scenes/Examples/EditorTesting.unity @@ -243,14 +243,12 @@ MonoBehaviour: proximity: 2 SynchronizePosition: 0 AllowCollisionOwnershipTransfer: 0 + Reliable: 0 serializedProgramAsset: {fileID: 11400000, guid: 12b3ab89a2110a54b8004b7c1e2587f7, type: 2} programSource: {fileID: 11400000, guid: c29d80bdbf2e26c4d8e2ba2e675781ed, type: 2} - serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgUAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAQcAAAB0AGUAcwB0AEkAbgB0ACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQBkAAAABwUCLwMAAAABSgAAAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAC4AVQBkAG8AbgBWAGEAcgBpAGEAYgBsAGUAYAAxAFsAWwBTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAXQBdACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgADAAAABgIAAAAAAAAAJwEEAAAAdAB5AHAAZQABFwAAAFMAeQBzAHQAZQBtAC4AUwB0AHIAaQBuAGcALAAgAG0AcwBjAG8AcgBsAGkAYgAnAQoAAABTAHkAbQBiAG8AbABOAGEAbQBlAAEKAAAAdABlAHMAdABTAHQAcgBpAG4AZwAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBBQAAAFYAYQBsAHUAZQABCwAAAEgAZQBsAGwAbwAgAFcAbwByAGwAZAAHBQIvBAAAAAFgAAAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQBgADEAWwBbAFUAbgBpAHQAeQBFAG4AZwBpAG4AZQAuAFQAcgBhAG4AcwBmAG8AcgBtACwAIABVAG4AaQB0AHkARQBuAGcAaQBuAGUALgBDAG8AcgBlAE0AbwBkAHUAbABlAF0AXQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ABAAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABDQAAAHQAZQBzAHQAVAByAGEAbgBzAGYAbwByAG0AJwEEAAAAdAB5AHAAZQABLQAAAFUAbgBpAHQAeQBFAG4AZwBpAG4AZQAuAFQAcgBhAG4AcwBmAG8AcgBtACwAIABVAG4AaQB0AHkARQBuAGcAaQBuAGUALgBDAG8AcgBlAE0AbwBkAHUAbABlAAsBBQAAAFYAYQBsAHUAZQAAAAAABwUCLwUAAAABYQAAAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAC4AVQBkAG8AbgBWAGEAcgBpAGEAYgBsAGUAYAAxAFsAWwBVAG4AaQB0AHkARQBuAGcAaQBuAGUALgBHAGEAbQBlAE8AYgBqAGUAYwB0ACwAIABVAG4AaQB0AHkARQBuAGcAaQBuAGUALgBDAG8AcgBlAE0AbwBkAHUAbABlAF0AXQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ABQAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABDgAAAHQAZQBzAHQARwBhAG0AZQBPAGIAagBlAGMAdAAnAQQAAAB0AHkAcABlAAEuAAAAVQBuAGkAdAB5AEUAbgBnAGkAbgBlAC4ARwBhAG0AZQBPAGIAagBlAGMAdAAsACAAVQBuAGkAdAB5AEUAbgBnAGkAbgBlAC4AQwBvAHIAZQBNAG8AZAB1AGwAZQALAQUAAABWAGEAbAB1AGUAAQAAAAcFAi8GAAAAAVMAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AVQBkAG8AbgBCAGUAaABhAHYAaQBvAHUAcgAsACAAVgBSAEMALgBVAGQAbwBuAF0AXQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ABgAAAAYCAAAAAAAAACcBBAAAAHQAeQBwAGUAARcAAABTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAJwEKAAAAUwB5AG0AYgBvAGwATgBhAG0AZQABEwAAAHQAZQBzAHQAUwBjAHIAaQBwAHQAUgBlAGYAZQByAGUAbgBjAGUAJwEEAAAAdAB5AHAAZQABIAAAAFYAUgBDAC4AVQBkAG8AbgAuAFUAZABvAG4AQgBlAGgAYQB2AGkAbwB1AHIALAAgAFYAUgBDAC4AVQBkAG8AbgALAQUAAABWAGEAbAB1AGUAAgAAAAcFBwUHBQ== - publicVariablesUnityEngineObjects: - - {fileID: 1695130166} - - {fileID: 1695130163} - - {fileID: 1695130165} + serializedPublicVariablesBytesString: Ai8AAAAAATIAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAFQAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AAAAAAAYBAAAAAAAAACcBBAAAAHQAeQBwAGUAAWgAAABTAHkAcwB0AGUAbQAuAEMAbwBsAGwAZQBjAHQAaQBvAG4AcwAuAEcAZQBuAGUAcgBpAGMALgBMAGkAcwB0AGAAMQBbAFsAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4ALgBJAG4AdABlAHIAZgBhAGMAZQBzAC4ASQBVAGQAbwBuAFYAYQByAGkAYQBiAGwAZQAsACAAVgBSAEMALgBVAGQAbwBuAC4AQwBvAG0AbQBvAG4AXQBdACwAIABtAHMAYwBvAHIAbABpAGIAAQEJAAAAVgBhAHIAaQBhAGIAbABlAHMALwEAAAABaAAAAFMAeQBzAHQAZQBtAC4AQwBvAGwAbABlAGMAdABpAG8AbgBzAC4ARwBlAG4AZQByAGkAYwAuAEwAaQBzAHQAYAAxAFsAWwBWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAEkAbgB0AGUAcgBmAGEAYwBlAHMALgBJAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgBdAF0ALAAgAG0AcwBjAG8AcgBsAGkAYgABAAAABgIAAAAAAAAAAi8CAAAAAUkAAABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgAuAFUAZABvAG4AVgBhAHIAaQBhAGIAbABlAGAAMQBbAFsAUwB5AHMAdABlAG0ALgBJAG4AdAAzADIALAAgAG0AcwBjAG8AcgBsAGkAYgBdAF0ALAAgAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAAIAAAAGAgAAAAAAAAAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBCgAAAFMAeQBtAGIAbwBsAE4AYQBtAGUAAQcAAAB0AGUAcwB0AEkAbgB0ACcBBAAAAHQAeQBwAGUAARYAAABTAHkAcwB0AGUAbQAuAEkAbgB0ADMAMgAsACAAbQBzAGMAbwByAGwAaQBiABcBBQAAAFYAYQBsAHUAZQAAAAAABwUCLwMAAAABSgAAAFYAUgBDAC4AVQBkAG8AbgAuAEMAbwBtAG0AbwBuAC4AVQBkAG8AbgBWAGEAcgBpAGEAYgBsAGUAYAAxAFsAWwBTAHkAcwB0AGUAbQAuAFMAdAByAGkAbgBnACwAIABtAHMAYwBvAHIAbABpAGIAXQBdACwAIABWAFIAQwAuAFUAZABvAG4ALgBDAG8AbQBtAG8AbgADAAAABgIAAAAAAAAAJwEEAAAAdAB5AHAAZQABFwAAAFMAeQBzAHQAZQBtAC4AUwB0AHIAaQBuAGcALAAgAG0AcwBjAG8AcgBsAGkAYgAnAQoAAABTAHkAbQBiAG8AbABOAGEAbQBlAAEKAAAAdABlAHMAdABTAHQAcgBpAG4AZwAnAQQAAAB0AHkAcABlAAEXAAAAUwB5AHMAdABlAG0ALgBTAHQAcgBpAG4AZwAsACAAbQBzAGMAbwByAGwAaQBiACcBBQAAAFYAYQBsAHUAZQABAAAAAAcFBwUHBQ== + publicVariablesUnityEngineObjects: [] publicVariablesSerializationDataFormat: 0 --- !u!4 &1695130166 Transform: diff --git a/Scripts/Common.meta b/Scripts/Common.meta new file mode 100644 index 0000000..1f6cd45 --- /dev/null +++ b/Scripts/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ba13d0994d1dd394fb7a38e342a8e2dc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Editor.meta b/Scripts/Common/Editor.meta new file mode 100644 index 0000000..8cd0f1f --- /dev/null +++ b/Scripts/Common/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5aceb78759142c849ad8ab57befcb983 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Editor/Networking.meta b/Scripts/Common/Editor/Networking.meta new file mode 100644 index 0000000..6e3c403 --- /dev/null +++ b/Scripts/Common/Editor/Networking.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ae3fe1f167fbefc4da235a8a105654a8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs b/Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs new file mode 100644 index 0000000..73af328 --- /dev/null +++ b/Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs @@ -0,0 +1,18 @@ + +#if !COMPILER_UDONSHARP && UNITY_EDITOR +using Guribo.UdonUtils.Scripts.Common.Networking; +using UnityEditor; + +namespace Guribo.UdonUtils.Scripts.Common.Editor.Networking +{ + [CustomEditor(typeof(OwnershipTransfer))] + public class OwnershipTransferEditor : UdonLibraryEditor + { + protected override string GetSymbolName() + { + return "ownershipTransfer"; + } + } +} +#endif + diff --git a/Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs.meta b/Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs.meta new file mode 100644 index 0000000..5b0d0b4 --- /dev/null +++ b/Scripts/Common/Editor/Networking/OwnershipTransferEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e2c21512ad0e81b41b14dc223c8fb956 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Editor/UdonCommonEditor.cs b/Scripts/Common/Editor/UdonCommonEditor.cs new file mode 100644 index 0000000..0387ad6 --- /dev/null +++ b/Scripts/Common/Editor/UdonCommonEditor.cs @@ -0,0 +1,21 @@ + +#if !COMPILER_UDONSHARP && UNITY_EDITOR +using System; +using UdonSharp; +using UdonSharpEditor; +using UnityEditor; +using UnityEngine; +using VRC.Udon; + +namespace Guribo.UdonUtils.Scripts.Common.Editor +{ + [CustomEditor(typeof(UdonCommon))] + public class UdonCommonEditor : UdonLibraryEditor + { + protected override string GetSymbolName() + { + return "udonCommon"; + } + } +} +#endif diff --git a/Scripts/Common/Editor/UdonCommonEditor.cs.meta b/Scripts/Common/Editor/UdonCommonEditor.cs.meta new file mode 100644 index 0000000..97f13ed --- /dev/null +++ b/Scripts/Common/Editor/UdonCommonEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c86899c631b4f246a31c75efacad6fe +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Editor/UdonDebugEditor.cs b/Scripts/Common/Editor/UdonDebugEditor.cs new file mode 100644 index 0000000..8b182cb --- /dev/null +++ b/Scripts/Common/Editor/UdonDebugEditor.cs @@ -0,0 +1,20 @@ +#if !COMPILER_UDONSHARP && UNITY_EDITOR +using System; +using UdonSharp; +using UdonSharpEditor; +using UnityEditor; +using UnityEngine; +using VRC.Udon; + +namespace Guribo.UdonUtils.Scripts.Common.Editor +{ + [CustomEditor(typeof(UdonDebug))] + public class UdonDebugEditor : UdonLibraryEditor + { + protected override string GetSymbolName() + { + return "udonDebug"; + } + } +} +#endif \ No newline at end of file diff --git a/Scripts/Common/Editor/UdonDebugEditor.cs.meta b/Scripts/Common/Editor/UdonDebugEditor.cs.meta new file mode 100644 index 0000000..b153c70 --- /dev/null +++ b/Scripts/Common/Editor/UdonDebugEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a0f4d34446d345b9b7ff8bcbfc2dcc0f +timeCreated: 1621152285 \ No newline at end of file diff --git a/Scripts/Common/Editor/UdonLibraryEditor.cs b/Scripts/Common/Editor/UdonLibraryEditor.cs new file mode 100644 index 0000000..8769d39 --- /dev/null +++ b/Scripts/Common/Editor/UdonLibraryEditor.cs @@ -0,0 +1,49 @@ +#if !COMPILER_UDONSHARP && UNITY_EDITOR +using System; +using UdonSharp; +using UdonSharpEditor; +using UnityEditor; +using UnityEngine; +using VRC.Udon; + +namespace Guribo.UdonUtils.Scripts.Common.Editor +{ + public abstract class UdonLibraryEditor : UnityEditor.Editor + { + protected abstract string GetSymbolName(); + + public override void OnInspectorGUI() + { + var symbolName = GetSymbolName(); + Debug.Assert(!string.IsNullOrEmpty(symbolName), "GetSymbolName provided valid string"); + + if (UdonSharpGUI.DrawDefaultUdonSharpBehaviourHeader(target)) return; + EditorGUILayout.Space(); + if (GUILayout.Button(new GUIContent($"Set {symbolName} references in scene", + $"Links all UdonBehaviours with '{symbolName}' parameter to this object"))) + { + var udonBehaviours = FindObjectsOfType(); + var value = UdonSharpEditorUtility.GetBackingUdonBehaviour((UdonSharpBehaviour) target); + + foreach (var udonBehaviour in udonBehaviours) + { + try + { + udonBehaviour.SetInspectorVariable(symbolName, value); + var udonBehaviourGameObject = udonBehaviour.gameObject; + Debug.Log($"Set {symbolName} reference on {udonBehaviourGameObject}.{udonBehaviour.name}", + udonBehaviourGameObject); + } + catch (Exception) + { + // ignored, fails for behaviours that don't have a symbol with that name + } + } + } + + EditorGUILayout.Space(); + base.OnInspectorGUI(); + } + } +} +#endif \ No newline at end of file diff --git a/Scripts/Common/Editor/UdonLibraryEditor.cs.meta b/Scripts/Common/Editor/UdonLibraryEditor.cs.meta new file mode 100644 index 0000000..8f1918c --- /dev/null +++ b/Scripts/Common/Editor/UdonLibraryEditor.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f8549596815a40b2b94d1ac975d217b1 +timeCreated: 1621151760 \ No newline at end of file diff --git a/Scripts/Common/Editor/UdonMathEditor.cs b/Scripts/Common/Editor/UdonMathEditor.cs new file mode 100644 index 0000000..ec9a229 --- /dev/null +++ b/Scripts/Common/Editor/UdonMathEditor.cs @@ -0,0 +1,21 @@ + +#if !COMPILER_UDONSHARP && UNITY_EDITOR +using System; +using UdonSharp; +using UdonSharpEditor; +using UnityEditor; +using UnityEngine; +using VRC.Udon; + +namespace Guribo.UdonUtils.Scripts.Common.Editor +{ + [CustomEditor(typeof(UdonMath))] + public class UdonMathEditor : UdonLibraryEditor + { + protected override string GetSymbolName() + { + return "udonMath"; + } + } +} +#endif diff --git a/Scripts/Common/Editor/UdonMathEditor.cs.meta b/Scripts/Common/Editor/UdonMathEditor.cs.meta new file mode 100644 index 0000000..beea729 --- /dev/null +++ b/Scripts/Common/Editor/UdonMathEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ab1a44b0ba276c46acdb97971ec7bfa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/HorizontalLookAt.asset b/Scripts/Common/HorizontalLookAt.asset new file mode 100644 index 0000000..589595b --- /dev/null +++ b/Scripts/Common/HorizontalLookAt.asset @@ -0,0 +1,200 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: HorizontalLookAt + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: b126f87a17287974a8e0af0ada790138, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 9e7f888abcc6fe842a80cb1fa38f96a3, type: 3} + behaviourSyncMode: 0 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: weight + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 3|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 4|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Single, mscorlib + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemSingle + - Name: symbolOriginalName + Entry: 1 + Data: weight + - Name: symbolUniqueName + Entry: 1 + Data: weight + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 6|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: e.g. 0.5 makes it blend 50% between initial rotation and target rotation, + 1.0 makes it look directly at the player + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 7|UnityEngine.RangeAttribute, UnityEngine.CoreModule + - Name: min + Entry: 4 + Data: 0 + - Name: max + Entry: 4 + Data: 1 + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: _initialRotation + - Name: $v + Entry: 7 + Data: 8|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 9|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 10|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.Quaternion, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 2 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: UnityEngineQuaternion + - Name: symbolOriginalName + Entry: 1 + Data: _initialRotation + - Name: symbolUniqueName + Entry: 1 + Data: _initialRotation + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/HorizontalLookAt.asset.meta b/Scripts/Common/HorizontalLookAt.asset.meta new file mode 100644 index 0000000..c0d1c89 --- /dev/null +++ b/Scripts/Common/HorizontalLookAt.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a37533707706cdc4ba5293865ef9c38c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/HorizontalLookAt.cs b/Scripts/Common/HorizontalLookAt.cs new file mode 100644 index 0000000..9ee8266 --- /dev/null +++ b/Scripts/Common/HorizontalLookAt.cs @@ -0,0 +1,42 @@ +using System; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; + +namespace Guribo.UdonUtils.Scripts.Common +{ + /// + /// turns this gameobject around to always look at the local player, only rotates vertical rotation + /// (pitch/roll are forced to 0) + /// + public class HorizontalLookAt : UdonSharpBehaviour + { + [Tooltip("e.g. 0.5 makes it blend 50% between initial rotation and target rotation, 1.0 makes it look directly at the player")] + [Range(0,1)] + public float weight = 1f; + + private Quaternion _initialRotation; + public void Start() + { + _initialRotation = transform.rotation; + } + + public void Update() + { + var localPlayer = VRC.SDKBase.Networking.LocalPlayer; + if (!Utilities.IsValid(localPlayer)) + { + return; + } + + var vectorToTarget = localPlayer.GetPosition() - transform.position; + var targetRotation = Quaternion.LookRotation(vectorToTarget, Vector3.up); + + // blend from initial rotation to target rotation based on strength + var yaw = Quaternion.Slerp(_initialRotation, targetRotation, weight).eulerAngles.y; + + // only apply yaw rotation part to this transform + transform.rotation = Quaternion.Euler(0, yaw, 0); + } + } +} \ No newline at end of file diff --git a/Scripts/Common/HorizontalLookAt.cs.meta b/Scripts/Common/HorizontalLookAt.cs.meta new file mode 100644 index 0000000..eecf814 --- /dev/null +++ b/Scripts/Common/HorizontalLookAt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9e7f888abcc6fe842a80cb1fa38f96a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Networking.meta b/Scripts/Common/Networking.meta new file mode 100644 index 0000000..7cf78c7 --- /dev/null +++ b/Scripts/Common/Networking.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f69151a63af18784d943683def0344fb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Networking/OwnerOnly.asset b/Scripts/Common/Networking/OwnerOnly.asset new file mode 100644 index 0000000..49e0898 --- /dev/null +++ b/Scripts/Common/Networking/OwnerOnly.asset @@ -0,0 +1,115 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: OwnerOnly + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 66417529d6d959743be0869576a9d7c7, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 3524d2a2a27bdf34f905a280042c0a21, type: 3} + behaviourSyncMode: 1 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: gameObjects + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 3|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 4|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.GameObject[], UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: UnityEngineGameObjectArray + - Name: symbolOriginalName + Entry: 1 + Data: gameObjects + - Name: symbolUniqueName + Entry: 1 + Data: gameObjects + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/Networking/OwnerOnly.asset.meta b/Scripts/Common/Networking/OwnerOnly.asset.meta new file mode 100644 index 0000000..33cb4a4 --- /dev/null +++ b/Scripts/Common/Networking/OwnerOnly.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9d7f3c7a72f844488ff7cbb04cfd1a6 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Networking/OwnerOnly.cs b/Scripts/Common/Networking/OwnerOnly.cs new file mode 100644 index 0000000..3706499 --- /dev/null +++ b/Scripts/Common/Networking/OwnerOnly.cs @@ -0,0 +1,46 @@ +using System; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; + +namespace Guribo.UdonUtils.Scripts.Common.Networking +{ + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + public class OwnerOnly : UdonSharpBehaviour + { + public GameObject[] gameObjects; + + public void OnEnable() + { + ToggleEnabled(VRC.SDKBase.Networking.IsOwner(gameObject)); + } + + public override void OnOwnershipTransferred(VRCPlayerApi player) + { + ToggleEnabled(VRC.SDKBase.Networking.IsOwner(gameObject)); + } + + private void ToggleEnabled(bool enable) + { + if (gameObjects == null) + { + return; + } + + foreach (var go in gameObjects) + { + if (!Utilities.IsValid(go)) + { + continue; + } + + if (go.activeSelf == enable) + { + continue; + } + + go.SetActive(enable); + } + } + } +} \ No newline at end of file diff --git a/Scripts/Common/Networking/OwnerOnly.cs.meta b/Scripts/Common/Networking/OwnerOnly.cs.meta new file mode 100644 index 0000000..56cdbc2 --- /dev/null +++ b/Scripts/Common/Networking/OwnerOnly.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3524d2a2a27bdf34f905a280042c0a21 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Networking/OwnershipTransfer.asset b/Scripts/Common/Networking/OwnershipTransfer.asset new file mode 100644 index 0000000..673d163 --- /dev/null +++ b/Scripts/Common/Networking/OwnershipTransfer.asset @@ -0,0 +1,189 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: OwnershipTransfer + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: c965fd3bcc7dce44eaf328e87588983f, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: fd5fbfc5cfc648088b9f4d0a579f38e9, type: 3} + behaviourSyncMode: 1 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: + - {fileID: 11500000, guid: 7577a31295cedd245927a61243113f27, type: 3} + - {fileID: 11500000, guid: 7fa968b472ba21e43aa479f0eb416d85, type: 3} + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: udonCommon + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 3|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 4|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: Guribo.UdonUtils.Scripts.Common.UdonCommon, Assembly-CSharp + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: VRCUdonUdonBehaviour + - Name: symbolOriginalName + Entry: 1 + Data: udonCommon + - Name: symbolUniqueName + Entry: 1 + Data: udonCommon + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 6|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: Libraries + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 10 + Data: 0 + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: udonDebug + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 8|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 9|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: Guribo.UdonUtils.Scripts.Common.UdonDebug, Assembly-CSharp + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: VRCUdonUdonBehaviour + - Name: symbolOriginalName + Entry: 1 + Data: udonDebug + - Name: symbolUniqueName + Entry: 1 + Data: udonDebug + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 10 + Data: 1 + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/Networking/OwnershipTransfer.asset.meta b/Scripts/Common/Networking/OwnershipTransfer.asset.meta new file mode 100644 index 0000000..5b36522 --- /dev/null +++ b/Scripts/Common/Networking/OwnershipTransfer.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 777efcf936ab8264b9f792163a8f4ae2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Networking/OwnershipTransfer.cs b/Scripts/Common/Networking/OwnershipTransfer.cs new file mode 100644 index 0000000..4cc883c --- /dev/null +++ b/Scripts/Common/Networking/OwnershipTransfer.cs @@ -0,0 +1,104 @@ +using System; +using UdonSharp; +using UnityEngine; +using VRC.SDK3.Components; +using VRC.SDKBase; +using VRC.Udon; + + +namespace Guribo.UdonUtils.Scripts.Common.Networking +{ + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + public class OwnershipTransfer : UdonSharpBehaviour + { + #region Libraries + + [Header("Libraries")] + public UdonCommon udonCommon; + public UdonDebug udonDebug; + + #endregion + + + /// + /// Changes the ownership of the entire hierarchy of the gameobject provided, including all relevant parents + /// and their children + /// + /// + /// + /// If set to true it is checked that we are the owner after ownership transfer, + /// if transfer was denied then false is returned. + /// If set to false the result of the ownership transfer is ignored and true is returned + /// True on success or false of transfer failed or is incomplete + public bool TransferOwnership(GameObject go, VRCPlayerApi newOwner, bool requireTransferSuccess) + { + if(!(udonDebug.Assert(Utilities.IsValid(go),"OwnershipTransfer.SetOwner: GameObject invalid", this) + && udonDebug.Assert(Utilities.IsValid(newOwner),"OwnershipTransfer.SetOwner: new owner invalid", this))) + { + return false; + } + + // find the top most udon behaviour + var topBehaviour = udonCommon.FindTopComponent(typeof(UdonBehaviour), go.transform); + if (!Utilities.IsValid(topBehaviour)) + { + Debug.LogError($"OwnershipTransfer.SetOwner: GameObject {go.name} " + + $"has no parent udon behaviour which could change ownership"); + return false; + } + + var allTransforms = topBehaviour.transform.GetComponentsInChildren(true); + + if (allTransforms == null || allTransforms.Length == 0) + { + Debug.LogError($"OwnershipTransfer.SetOwner: GameObject {go.name} " + + $"has no udon behaviours it its hierarchy"); + return false; + } + + var anyFailures = false; + var newOwnerPlayerId = newOwner.playerId; + + foreach (var childTransform in allTransforms) + { + if (!Utilities.IsValid(childTransform)) + { + Debug.LogWarning("OwnershipTransfer.SetOwner: invalid transform found. Skipping."); + continue; + } + + var childGo = childTransform.gameObject; + // make sure to not overload the network by only taking ownership of objects that have synced components + if (Utilities.IsValid(childGo.GetComponent(typeof(UdonBehaviour))) + || Utilities.IsValid(childGo.GetComponent(typeof(VRC.SDKBase.VRCStation))) + || Utilities.IsValid(childGo.GetComponent(typeof(VRC_Pickup))) + || Utilities.IsValid(childGo.GetComponent(typeof(VRCObjectSync)))) + { + var oldOwnerId = -1; + var oldOwner = VRC.SDKBase.Networking.GetOwner(childTransform.gameObject); + if (Utilities.IsValid(oldOwner)) + { + oldOwnerId = oldOwner.playerId; + } + + Debug.Log($"OwnershipTransfer.SetOwner: setting owner of " + + $"'{childTransform.gameObject.name}' " + + $"from player {oldOwnerId} to player {newOwnerPlayerId}"); + + if (!VRC.SDKBase.Networking.IsOwner(childTransform.gameObject)) + { + VRC.SDKBase.Networking.SetOwner(newOwner, childTransform.gameObject); + + // check, if required whether we are the owner now + if (requireTransferSuccess && !VRC.SDKBase.Networking.IsOwner(childTransform.gameObject)) + { + anyFailures = true; + } + } + } + } + + return !requireTransferSuccess || !anyFailures; + } + } +} \ No newline at end of file diff --git a/Scripts/Common/Networking/OwnershipTransfer.cs.meta b/Scripts/Common/Networking/OwnershipTransfer.cs.meta new file mode 100644 index 0000000..c530c4f --- /dev/null +++ b/Scripts/Common/Networking/OwnershipTransfer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fd5fbfc5cfc648088b9f4d0a579f38e9 +timeCreated: 1618065054 \ No newline at end of file diff --git a/Scripts/Common/Networking/SyncedInteger.asset b/Scripts/Common/Networking/SyncedInteger.asset new file mode 100644 index 0000000..4b75ab3 --- /dev/null +++ b/Scripts/Common/Networking/SyncedInteger.asset @@ -0,0 +1,606 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: SyncedInteger + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: b3c363390b2ca37449a8d67e56bce2fe, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 64b2c7b826b74c6ead3a2d763843fa6a, type: 3} + behaviourSyncMode: 3 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 8 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: syncedValue + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 3|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 4|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Int32, mscorlib + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 1 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemInt32 + - Name: symbolOriginalName + Entry: 1 + Data: syncedValue + - Name: symbolUniqueName + Entry: 1 + Data: syncedValue + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 6|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: _oldValue + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 8|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 9 + Data: 4 + - Name: declarationType + Entry: 3 + Data: 2 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemInt32 + - Name: symbolOriginalName + Entry: 1 + Data: _oldValue + - Name: symbolUniqueName + Entry: 1 + Data: _oldValue + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 9|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: targetBehaviour + - Name: $v + Entry: 7 + Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 11|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 12|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: VRC.Udon.UdonBehaviour, VRC.Udon + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: VRCUdonUdonBehaviour + - Name: symbolOriginalName + Entry: 1 + Data: targetBehaviour + - Name: symbolUniqueName + Entry: 1 + Data: targetBehaviour + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 14|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: targetVariable + - Name: $v + Entry: 7 + Data: 15|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 16|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 17|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.String, mscorlib + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemString + - Name: symbolOriginalName + Entry: 1 + Data: targetVariable + - Name: symbolUniqueName + Entry: 1 + Data: targetVariable + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 18|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 19|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: targetChangeEvent + - Name: $v + Entry: 7 + Data: 20|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 21|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 9 + Data: 17 + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemString + - Name: symbolOriginalName + Entry: 1 + Data: targetChangeEvent + - Name: symbolUniqueName + Entry: 1 + Data: targetChangeEvent + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 22|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 23|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Event to fire on all players when the value changes (instantly called + on the owner) + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 24|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: targetPreSerialization + - Name: $v + Entry: 7 + Data: 25|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 26|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 9 + Data: 17 + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemString + - Name: symbolOriginalName + Entry: 1 + Data: targetPreSerialization + - Name: symbolUniqueName + Entry: 1 + Data: targetPreSerialization + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 27|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 28|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Event to fire on the owner when the value is about to be sent + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 29|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: targetDeserializeEvent + - Name: $v + Entry: 7 + Data: 30|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 31|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 9 + Data: 17 + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemString + - Name: symbolOriginalName + Entry: 1 + Data: targetDeserializeEvent + - Name: symbolUniqueName + Entry: 1 + Data: targetDeserializeEvent + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 32|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 33|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Event to fire on non-owning players when a value was received (can be + the same value) + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 34|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: targetSerializedEvent + - Name: $v + Entry: 7 + Data: 35|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 36|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 9 + Data: 17 + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemString + - Name: symbolOriginalName + Entry: 1 + Data: targetSerializedEvent + - Name: symbolUniqueName + Entry: 1 + Data: targetSerializedEvent + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 37|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 2 + - Name: + Entry: 7 + Data: 38|UnityEngine.TooltipAttribute, UnityEngine.CoreModule + - Name: tooltip + Entry: 1 + Data: Event to fire on the owner when the value was successfully sent + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: 39|UnityEngine.SerializeField, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/Networking/SyncedInteger.asset.meta b/Scripts/Common/Networking/SyncedInteger.asset.meta new file mode 100644 index 0000000..34f6aa8 --- /dev/null +++ b/Scripts/Common/Networking/SyncedInteger.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c323dfc89548c2e4cb25c6369b832dff +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/Networking/SyncedInteger.cs b/Scripts/Common/Networking/SyncedInteger.cs new file mode 100644 index 0000000..d5dcd6b --- /dev/null +++ b/Scripts/Common/Networking/SyncedInteger.cs @@ -0,0 +1,140 @@ +using System; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; +using VRC.Udon.Common; + +namespace Guribo.UdonUtils.Scripts.Common.Networking +{ + /// + /// Component which is used to synchronize a value on demand independently from high continuous synced udon + /// behaviours to reduce bandwidth. + /// + [UdonBehaviourSyncMode(BehaviourSyncMode.Manual)] + public class SyncedInteger : UdonSharpBehaviour + { + [UdonSynced] + public int syncedValue = -1; + + private int _oldValue = -1; + + /// + /// Udon behaviour that wants to have one of its variables synced to all players + /// + [SerializeField] protected UdonBehaviour targetBehaviour; + /// + /// Variable which will get synchronized with all players + /// + [SerializeField] protected string targetVariable = "mySyncedInteger"; + [Tooltip("Event to fire on all players when the value changes (instantly called on the owner)")] + [SerializeField] protected string targetChangeEvent; + [Tooltip("Event to fire on the owner when the value is about to be sent")] + [SerializeField] protected string targetPreSerialization; + [Tooltip("Event to fire on non-owning players when a value was received (can be the same value)")] + [SerializeField] protected string targetDeserializeEvent; + [Tooltip("Event to fire on the owner when the value was successfully sent")] + [SerializeField] protected string targetSerializedEvent; + + /// + /// Triggers Serialization of the manually synced player id. + /// Does nothing if the caller does not own this behaviour/gameobject. + /// + /// false if the local player is not the owner or anything goes wrong + public bool UpdateForAll() + { + var localPlayer = VRC.SDKBase.Networking.LocalPlayer; + if (!Utilities.IsValid(targetBehaviour) + || !Utilities.IsValid(localPlayer) + || !localPlayer.IsOwner(gameObject)) + { + return false; + } + + if (!string.IsNullOrEmpty(targetPreSerialization)) + { + targetBehaviour.SendCustomEvent(targetPreSerialization); + } + + var value = targetBehaviour.GetProgramVariable(targetVariable); + if (value == null) + { + Debug.LogError( + $"SyncedInteger.UpdateForAll: '{targetVariable}' does not exist in '{targetBehaviour.name}'", this); + return false; + } + + // ReSharper disable once OperatorIsCanBeUsed + if (value.GetType() == typeof(int)) + { + syncedValue = (int) value; + UpdateOldValueAndTriggerChangeEvent(); + RequestSerialization(); + + return true; + } + + Debug.LogError( + $"SyncedInteger.UpdateForAll: '{targetVariable}' in '{targetBehaviour.name}' is not an integer", this); + return false; + } + + private void UpdateOldValueAndTriggerChangeEvent() + { + if (_oldValue != syncedValue) + { + _oldValue = syncedValue; + if (!string.IsNullOrEmpty(targetChangeEvent)) + { + targetBehaviour.SendCustomEvent(targetChangeEvent); + } + } + } + + 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(); + } + + public override void OnPostSerialization(SerializationResult result) + { + var localPlayer = VRC.SDKBase.Networking.LocalPlayer; + if (!(localPlayer.IsOwner(gameObject) + && Utilities.IsValid(targetBehaviour) + && Utilities.IsValid(localPlayer))) + { + Debug.LogWarning($"SyncedInteger.OnPostSerialization: aborting", this); + return; + } + + if (!result.success) + { + Debug.LogWarning($"SyncedInteger.OnPostSerialization: Serialization failed, trying again", this); + RequestSerialization(); + return; + } + + Debug.Log($"SyncedInteger.OnPostSerialization: Serialized {result.byteCount} bytes"); + + if (!string.IsNullOrEmpty(targetSerializedEvent)) + { + targetBehaviour.SendCustomEvent(targetSerializedEvent); + } + } + } +} \ No newline at end of file diff --git a/Scripts/Common/Networking/SyncedInteger.cs.meta b/Scripts/Common/Networking/SyncedInteger.cs.meta new file mode 100644 index 0000000..a048846 --- /dev/null +++ b/Scripts/Common/Networking/SyncedInteger.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 64b2c7b826b74c6ead3a2d763843fa6a +timeCreated: 1617726399 \ No newline at end of file diff --git a/Scripts/Common/ReflectionProbeController.asset b/Scripts/Common/ReflectionProbeController.asset new file mode 100644 index 0000000..97fa96b --- /dev/null +++ b/Scripts/Common/ReflectionProbeController.asset @@ -0,0 +1,263 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: ReflectionProbeController + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: e2a1b920e1010b74f9a197681ec87985, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: fe152f1571633cd499a864b691a7c791, type: 3} + behaviourSyncMode: 1 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: + - {fileID: 11500000, guid: 7fa968b472ba21e43aa479f0eb416d85, type: 3} + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 3 + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: udonDebug + - Name: $v + Entry: 7 + Data: 2|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 3|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 4|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: Guribo.UdonUtils.Scripts.Common.UdonDebug, Assembly-CSharp + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: VRCUdonUdonBehaviour + - Name: symbolOriginalName + Entry: 1 + Data: udonDebug + - Name: symbolUniqueName + Entry: 1 + Data: udonDebug + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 5|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 6|UnityEngine.HeaderAttribute, UnityEngine.CoreModule + - Name: header + Entry: 1 + Data: Libraries + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 10 + Data: 0 + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: reflectionProbe + - Name: $v + Entry: 7 + Data: 7|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 8|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 9|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: UnityEngine.ReflectionProbe, UnityEngine.CoreModule + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: UnityEngineReflectionProbe + - Name: symbolOriginalName + Entry: 1 + Data: reflectionProbe + - Name: symbolUniqueName + Entry: 1 + Data: reflectionProbe + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 10|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: updateInterval + - Name: $v + Entry: 7 + Data: 11|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: fieldSymbol + Entry: 7 + Data: 12|UdonSharp.Compiler.SymbolDefinition, UdonSharp.Editor + - Name: internalType + Entry: 7 + Data: 13|System.RuntimeType, mscorlib + - Name: + Entry: 1 + Data: System.Single, mscorlib + - Name: + Entry: 8 + Data: + - Name: declarationType + Entry: 3 + Data: 1 + - Name: syncMode + Entry: 3 + Data: 0 + - Name: symbolResolvedTypeName + Entry: 1 + Data: SystemSingle + - Name: symbolOriginalName + Entry: 1 + Data: updateInterval + - Name: symbolUniqueName + Entry: 1 + Data: updateInterval + - Name: symbolDefaultValue + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: fieldAttributes + Entry: 7 + Data: 14|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 1 + - Name: + Entry: 7 + Data: 15|UnityEngine.RangeAttribute, UnityEngine.CoreModule + - Name: min + Entry: 4 + Data: 0 + - Name: max + Entry: 4 + Data: 60 + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: userBehaviourSource + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/ReflectionProbeController.asset.meta b/Scripts/Common/ReflectionProbeController.asset.meta new file mode 100644 index 0000000..9bf6e0c --- /dev/null +++ b/Scripts/Common/ReflectionProbeController.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8055898f61972ba49aaef80c72d2fba3 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/ReflectionProbeController.cs b/Scripts/Common/ReflectionProbeController.cs new file mode 100644 index 0000000..749c3eb --- /dev/null +++ b/Scripts/Common/ReflectionProbeController.cs @@ -0,0 +1,49 @@ +using System; +using Guribo.UdonUtils.Scripts.Common; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon.Common.Enums; + +namespace Guribo.UdonUtils.Scripts.Common +{ + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + public class ReflectionProbeController : UdonSharpBehaviour + { + #region Libraries + + [Header("Libraries")] + public UdonDebug udonDebug; + + #endregion + + public ReflectionProbe reflectionProbe; + + [Range(0, 60)] + public float updateInterval = 10f; + + public void OnEnable() + { + if (!udonDebug.Assert(Utilities.IsValid(reflectionProbe), "reflectionProbe invalid", this)) + { + return; + } + + UpdateReflections(); + } + + public void UpdateReflections() + { + if (!(gameObject.activeInHierarchy + && enabled + && udonDebug.Assert(Utilities.IsValid(reflectionProbe), "reflectionProbe invalid", this))) + { + return; + } + + reflectionProbe.RenderProbe(); + + SendCustomEventDelayedSeconds(nameof(UpdateReflections), updateInterval); + } + } +} \ No newline at end of file diff --git a/Scripts/Common/ReflectionProbeController.cs.meta b/Scripts/Common/ReflectionProbeController.cs.meta new file mode 100644 index 0000000..0a54839 --- /dev/null +++ b/Scripts/Common/ReflectionProbeController.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fe152f1571633cd499a864b691a7c791 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/UdonCommon.asset b/Scripts/Common/UdonCommon.asset new file mode 100644 index 0000000..186a71e --- /dev/null +++ b/Scripts/Common/UdonCommon.asset @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: UdonCommon + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 376aa8c882e940b498a22f9c3dc109e3, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 7577a31295cedd245927a61243113f27, type: 3} + behaviourSyncMode: 1 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/UdonCommon.asset.meta b/Scripts/Common/UdonCommon.asset.meta new file mode 100644 index 0000000..9f1f173 --- /dev/null +++ b/Scripts/Common/UdonCommon.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f1a80167fd5f061499c834bb971daf3b +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/UdonCommon.cs b/Scripts/Common/UdonCommon.cs new file mode 100644 index 0000000..d496a1d --- /dev/null +++ b/Scripts/Common/UdonCommon.cs @@ -0,0 +1,42 @@ +using System; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + +namespace Guribo.UdonUtils.Scripts.Common +{ + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + public class UdonCommon : UdonSharpBehaviour + { + /// + /// Finds the component of a given type in the current gameobject hierarchy which is closest to the scene root + /// + /// + /// + /// the found component or null if none was found + public Component FindTopComponent(Type type, Transform start) + { + if (!Utilities.IsValid(start)) + { + return null; + } + + Component topComponent = null; + var topTransform = start; + + do + { + var behaviour = topTransform.GetComponent(type); + if (Utilities.IsValid(behaviour)) + { + topComponent = behaviour; + } + + topTransform = topTransform.parent; + } while (Utilities.IsValid(topTransform)); + + return topComponent; + } + } +} diff --git a/Scripts/Common/UdonCommon.cs.meta b/Scripts/Common/UdonCommon.cs.meta new file mode 100644 index 0000000..34109e8 --- /dev/null +++ b/Scripts/Common/UdonCommon.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7577a31295cedd245927a61243113f27 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/UdonDebug.asset b/Scripts/Common/UdonDebug.asset new file mode 100644 index 0000000..5d2fd7f --- /dev/null +++ b/Scripts/Common/UdonDebug.asset @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: UdonDebug + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 38b8d3d02ad23bd468e0c49452e108cb, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 7fa968b472ba21e43aa479f0eb416d85, type: 3} + behaviourSyncMode: 1 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/UdonDebug.asset.meta b/Scripts/Common/UdonDebug.asset.meta new file mode 100644 index 0000000..c135d42 --- /dev/null +++ b/Scripts/Common/UdonDebug.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ccfba9ab8ff45f64c9539764aa13ec95 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/UdonDebug.cs b/Scripts/Common/UdonDebug.cs new file mode 100644 index 0000000..13ca428 --- /dev/null +++ b/Scripts/Common/UdonDebug.cs @@ -0,0 +1,32 @@ +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + + +namespace Guribo.UdonUtils.Scripts.Common +{ + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + public class UdonDebug : UdonSharpBehaviour + { + public bool Assert(bool condition, string message, Object context) + { + if (!condition) + { + if (Utilities.IsValid(context)) + { + Debug.LogError("Assertion failed : '" + context.GetType() + " : " + message + "'", context); + } + else + { + Debug.LogError("Assertion failed : 'UNKNOWN TYPE: " + message + "'"); + } + + return false; + } + + Debug.Assert(condition, message); + return true; + } + } +} diff --git a/Scripts/Common/UdonDebug.cs.meta b/Scripts/Common/UdonDebug.cs.meta new file mode 100644 index 0000000..df2806b --- /dev/null +++ b/Scripts/Common/UdonDebug.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7fa968b472ba21e43aa479f0eb416d85 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/UdonMath.asset b/Scripts/Common/UdonMath.asset new file mode 100644 index 0000000..9893248 --- /dev/null +++ b/Scripts/Common/UdonMath.asset @@ -0,0 +1,52 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3} + m_Name: UdonMath + m_EditorClassIdentifier: + serializedUdonProgramAsset: {fileID: 11400000, guid: 5b10d8de98911b343bc4026f9301f605, + type: 2} + udonAssembly: + assemblyError: + sourceCsScript: {fileID: 11500000, guid: 55f0076821f05564b9a18510eaafb502, type: 3} + behaviourSyncMode: 1 + behaviourIDHeapVarName: __refl_const_intnl_udonTypeID + compileErrors: [] + hasInteractEvent: 0 + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: fieldDefinitions + Entry: 7 + Data: 0|System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[UdonSharp.Compiler.FieldDefinition, + UdonSharp.Editor]], mscorlib + - Name: comparer + Entry: 7 + Data: 1|System.Collections.Generic.GenericEqualityComparer`1[[System.String, + mscorlib]], mscorlib + - Name: + Entry: 8 + Data: + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: diff --git a/Scripts/Common/UdonMath.asset.meta b/Scripts/Common/UdonMath.asset.meta new file mode 100644 index 0000000..f66bf3e --- /dev/null +++ b/Scripts/Common/UdonMath.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e7ee04f28c429a6408a600a72eeede95 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/Common/UdonMath.cs b/Scripts/Common/UdonMath.cs new file mode 100644 index 0000000..aeacef6 --- /dev/null +++ b/Scripts/Common/UdonMath.cs @@ -0,0 +1,99 @@ +using System; +using UdonSharp; +using UnityEngine; +using VRC.SDKBase; +using VRC.Udon; + + +namespace Guribo.UdonUtils.Scripts.Common +{ + [UdonBehaviourSyncMode(BehaviourSyncMode.NoVariableSync)] + public class UdonMath : UdonSharpBehaviour + { + public float Remap(float inMin, float inMax, float outMin, float outMax, float value) + { + var t = InverseLerp(inMin, inMax, value); + return Lerp(outMin, outMax, t); + } + + /// + /// unclamped + /// + /// + /// + /// + /// + public float InverseLerp(float a, float b, float value) + { + var divisor = b - a; + if (divisor == 0f) + { + return a; + } + + return (value - a) / divisor; + } + + /// + /// unclamped + /// + /// + /// + /// + /// + public float Lerp(float a, float b, float t) + { + return (1f - t) * a + t * b; + } + + /// + /// input should be between -1 to 1 + /// + /// + /// + /// + public float ApplyExpo(float input, float factor) + { + return (1f - factor) * (input * input * input) + (factor * input); + } + + /// + /// + /// + /// x=p, y=i, z=d + /// + /// + /// + /// + /// + /// result, integral, currentError + public Vector3 PidUpdate(Vector3 pid, + float previousIntegral, + float previousError, + float currentValue, + float targetValue, + float deltaTime) + { + var currentError = targetValue - currentValue; + + var proportional = pid.x * currentError; + var integral = previousIntegral + deltaTime * pid.y * currentError; + var derivative = pid.z * (currentError - previousError) / deltaTime; + + var result = proportional + integral + derivative; + + return new Vector3(result, integral, currentError); + } + + /// + /// given two (e.g. world) rotations a and b it will return the rotation c which can transform a into b (e.g. b = a * c) + /// + /// + /// + /// delta rotation which can turn a into b + public Quaternion GetDeltaAToB(Quaternion a, Quaternion b) + { + return Quaternion.Inverse(a) * b; + } + } +} \ No newline at end of file diff --git a/Scripts/Common/UdonMath.cs.meta b/Scripts/Common/UdonMath.cs.meta new file mode 100644 index 0000000..0ea0316 --- /dev/null +++ b/Scripts/Common/UdonMath.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55f0076821f05564b9a18510eaafb502 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/PackageExporter.cs b/Scripts/PackageExporter.cs new file mode 100644 index 0000000..6cd5eab --- /dev/null +++ b/Scripts/PackageExporter.cs @@ -0,0 +1,191 @@ +#if UNITY_EDITOR +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using UnityEditor; +using UnityEngine; +using UnityEngine.SceneManagement; +using Debug = UnityEngine.Debug; + +namespace Guribo.UdonUtils.Scripts.Editor +{ + public abstract class PackageExporter : MonoBehaviour + { + protected readonly string UnityPackageExtension = "unitypackage"; + + // /// TODO not used (remove?) + // /// exports the unity package after successfully building + // /// + // /// + // /// + // /// + // [PostProcessBuild] + // public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) + // { + // ExportBetterAudioPackage(pathToBuiltProject); + // } + + // TODO override and add e.g. [MenuItem("Menu/Item/Path/Export My Package")] + // TODO call Export() in the override + public static void ExportPackage() + { + Export(); + } + + protected static void Export() where T : PackageExporter + { + var go = new GameObject {hideFlags = HideFlags.DontSave}; + try + { + var packageExporter = (T) go.AddComponent(typeof(T)); + Debug.Assert(packageExporter); + packageExporter.ExportPackage(packageExporter.GetExportPath()); + } + catch (Exception e) + { + Debug.LogException(e); + } + finally + { + DestroyImmediate(go); + } + } + + protected abstract string GetRepositoryPath(); + protected abstract string GetExportPath(); + protected abstract string GetReleaseVersion(); + protected abstract string GetUnityPackage(); + protected abstract string[] GetExportAssets(); + + public string GetCommitHash() + { + var cmd = new Process(); + var processStartInfo = cmd.StartInfo; + processStartInfo.FileName = "cmd.exe"; + processStartInfo.RedirectStandardInput = true; + processStartInfo.RedirectStandardOutput = true; + processStartInfo.CreateNoWindow = true; + processStartInfo.UseShellExecute = false; + cmd.Start(); + var cmdStandardInput = cmd.StandardInput; + cmdStandardInput.Flush(); + var repositoryPath = GetRepositoryPath(); + cmdStandardInput.WriteLine($"cd {repositoryPath} && git rev-parse --short HEAD"); + cmdStandardInput.Flush(); + cmdStandardInput.Close(); + cmd.WaitForExit(); + var cmdStandardOutput = cmd.StandardOutput; + + // ignore the first 4 lines + for (var i = 0; i < 4; ++i) + { + cmdStandardOutput.ReadLine(); + } + + // get the commit hash + var commitHash = cmdStandardOutput.ReadLine(); + + // ignore the rest + cmdStandardOutput.ReadToEnd(); + + // verify we actually succeeded + if (cmd.ExitCode != 0 + || commitHash == null + || string.IsNullOrWhiteSpace(commitHash)) + { + throw new Exception($"Failed to get git hash for repository '{repositoryPath}'"); + } + + var trimmedHash = commitHash.Trim(); + Debug.Log($"Found git hash '{trimmedHash}'"); + + return trimmedHash; + } + + + /// + /// + /// + /// + /// + /// + private void ExportPackage(string pathToBuiltProject) + { + if (pathToBuiltProject == null + || string.IsNullOrEmpty(pathToBuiltProject) + || string.IsNullOrWhiteSpace(pathToBuiltProject)) + { + throw new ArgumentException($"Invalid path {pathToBuiltProject}"); + } + + // absolute path of built project + var directoryInfo = Directory.GetParent(@pathToBuiltProject); + if (directoryInfo == null) + { + throw new ArgumentException($"Invalid directory {pathToBuiltProject}"); + } + + var buildDirectory = directoryInfo.FullName; + + // absolute path of unity project + var workingDirectory = Path.GetFullPath(@Environment.CurrentDirectory); + + Debug.Log($"Exporting BetterPlayerAudio Unity Package to '{buildDirectory}' from '{workingDirectory}'"); + + var repositoryPath = GetRepositoryPath(); + var releaseVersion = GetReleaseVersion(); + var versionFilePath = $"{repositoryPath}/{releaseVersion}"; + var version = File.ReadLines(versionFilePath).First(); + if (string.IsNullOrWhiteSpace(version)) + { + throw new Exception($"Failed to get version from '{versionFilePath}'"); + } + + var packageTargetPath = Path.Combine(buildDirectory, + $"{GetUnityPackage()}_{version.Trim()}_{GetCommitHash()}.{UnityPackageExtension}"); + + Debug.Log($"Exporting to '{packageTargetPath}'"); + + var exportAssets = GetExportAssets(); + foreach (var exportAsset in exportAssets) + { + if (!IsValidFileName(exportAsset)) + { + throw new ArgumentException($"Invalid file path: '{exportAsset}'"); + } + } + + // AssetDatabase.ExportPackage(ExportAssets, packageTargetPath,ExportPackageOptions.Recurse | ExportPackageOptions.Interactive | ExportPackageOptions.IncludeDependencies); + AssetDatabase.ExportPackage(exportAssets, packageTargetPath, + ExportPackageOptions.Recurse | ExportPackageOptions.Interactive); + } + + /// + /// Source: https://stackoverflow.com/questions/422090/in-c-sharp-check-that-filename-is-possibly-valid-not-that-it-exists + /// + /// + /// + public static bool IsValidFileName(string fileName) + { + if (string.IsNullOrEmpty(fileName)) + { + return false; + } + + FileInfo fileInfo = null; + try + { + fileInfo = new FileInfo(fileName); + } + catch (Exception) + { + // ignored + } + + return !ReferenceEquals(fileInfo, null); + } + } +} +#endif \ No newline at end of file diff --git a/Scripts/PackageExporter.cs.meta b/Scripts/PackageExporter.cs.meta new file mode 100644 index 0000000..dac25e1 --- /dev/null +++ b/Scripts/PackageExporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e9d4d1734bc9434d937e56744476596 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Scripts/UdonUtilsPackageExporter.cs b/Scripts/UdonUtilsPackageExporter.cs new file mode 100644 index 0000000..4f23af8 --- /dev/null +++ b/Scripts/UdonUtilsPackageExporter.cs @@ -0,0 +1,51 @@ +#if UNITY_EDITOR +using Guribo.UdonUtils.Scripts.Editor; +using UnityEditor; + +namespace Guribo.UdonUtils.Scripts +{ + public class UdonUtilsPackageExporter : PackageExporter + { + [MenuItem("Guribo/UDON/UdonUtils/Export Unity Package")] + public new static void ExportPackage() + { + Export(); + } + + protected override string GetRepositoryPath() + { + return "./Assets/Guribo/UdonUtils"; + } + + protected override string GetExportPath() + { + return "./Assets/Guribo/UdonUtils/Releases/"; + } + + protected override string GetReleaseVersion() + { + return "Version.txt"; + } + + protected override string GetUnityPackage() + { + return "GuriboUdonUtils"; + } + + protected override string[] GetExportAssets() + { + return new[] + { + "Assets/Guribo/UdonUtils/Graphs", + "Assets/Guribo/UdonUtils/Prefabs", + "Assets/Guribo/UdonUtils/README", + "Assets/Guribo/UdonUtils/Scenes", + "Assets/Guribo/UdonUtils/Scripts", + "Assets/Guribo/UdonUtils/LICENSE", + "Assets/Guribo/UdonUtils/README.md", + "Assets/Guribo/UdonUtils/Version.txt" + }; + } + } +} +#endif diff --git a/Scripts/UdonUtilsPackageExporter.cs.meta b/Scripts/UdonUtilsPackageExporter.cs.meta new file mode 100644 index 0000000..2dcbd94 --- /dev/null +++ b/Scripts/UdonUtilsPackageExporter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91ce5fc9c08c2a744aeb2c5063f165f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Version.txt b/Version.txt new file mode 100644 index 0000000..a92e827 --- /dev/null +++ b/Version.txt @@ -0,0 +1 @@ +v0.0.4 \ No newline at end of file diff --git a/Version.txt.meta b/Version.txt.meta new file mode 100644 index 0000000..76bc64a --- /dev/null +++ b/Version.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f46aec24918d57e49a13fd458d6a03a4 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: