generated from vrchat-community/template-package
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Re-Sync Button & Global Sync Button
- Loading branch information
Showing
8 changed files
with
904 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
Packages/idv.jlchntoz.vvmw/Editor/VVMW/Designer/ResyncButtonPreprocessor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
using UnityEngine.SceneManagement; | ||
using UnityEditor.Build; | ||
using UnityEditor.Build.Reporting; | ||
using UnityEditor.Events; | ||
using UdonSharpEditor; | ||
|
||
namespace JLChnToZ.VRC.VVMW.Designer { | ||
internal sealed class ResyncButtonPreprocessor : IProcessSceneWithReport { | ||
public int callbackOrder => -1; | ||
|
||
public void OnProcessScene(Scene scene, BuildReport report) { | ||
foreach (var entry in scene.IterateAllComponents<ResyncButtonConfigurator>()) { | ||
if (!entry.TryGetComponent(out Button button)) { | ||
Debug.LogWarning($"[ResyncButton] No button component in {entry.name}. This should not happen.", entry); | ||
continue; | ||
} | ||
if (entry.core == null) { | ||
Debug.LogWarning($"[ResyncButton] Core component in {entry.name} is not assigned.", entry); | ||
continue; | ||
} | ||
var udon = UdonSharpEditorUtility.GetBackingUdonBehaviour(entry.core); | ||
if (udon == null) { | ||
Debug.LogWarning($"[ResyncButton] Misconfigurated Core component in {entry.name}.", entry); | ||
continue; | ||
} | ||
UnityEventTools.AddStringPersistentListener( | ||
button.onClick, | ||
udon.SendCustomEvent, | ||
entry.globalSync ? nameof(Core.GlobalSync) : nameof(Core.LocalSync) | ||
); | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Packages/idv.jlchntoz.vvmw/Editor/VVMW/Designer/ResyncButtonPreprocessor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
152 changes: 152 additions & 0 deletions
152
Packages/idv.jlchntoz.vvmw/Prefabs/Global Sync Button.prefab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!1001 &1667209002103275573 | ||
PrefabInstance: | ||
m_ObjectHideFlags: 0 | ||
serializedVersion: 2 | ||
m_Modification: | ||
m_TransformParent: {fileID: 0} | ||
m_Modifications: | ||
- target: {fileID: 2135834656162038991, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: serializationData.Prefab | ||
value: | ||
objectReference: {fileID: 2135834656162038991, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchorMax.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchorMin.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_SizeDelta.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_SizeDelta.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchoredPosition.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3129433485070536689, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchoredPosition.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3180401798966787971, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_Size.x | ||
value: 300 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_RootOrder | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_LocalPosition.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_LocalPosition.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_LocalEulerAnglesHint.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_LocalEulerAnglesHint.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3274486473114602996, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_LocalEulerAnglesHint.z | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 3586576509636266015, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: globalSync | ||
value: 1 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchorMax.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchorMin.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_SizeDelta.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_SizeDelta.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchoredPosition.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6947233848682010541, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchoredPosition.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 6966352474747331409, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_Name | ||
value: Global Sync Button Variant | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchorMax.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchorMin.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_SizeDelta.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_SizeDelta.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchoredPosition.x | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
- target: {fileID: 8604344439434953016, guid: a9c62789c705a85428df158bfee22825, | ||
type: 3} | ||
propertyPath: m_AnchoredPosition.y | ||
value: 0 | ||
objectReference: {fileID: 0} | ||
m_RemovedComponents: [] | ||
m_SourcePrefab: {fileID: 100100000, guid: a9c62789c705a85428df158bfee22825, type: 3} |
7 changes: 7 additions & 0 deletions
7
Packages/idv.jlchntoz.vvmw/Prefabs/Global Sync Button.prefab.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.