avatar/Assets/VRCSDK/Dependencies/VRChat/Editor/Components/VRCPlayerModEditorWindow.cs
2022-09-27 20:47:45 -07:00

37 lines
923 B
C#

#if VRC_SDK_VRCSDK2
using UnityEngine;
using UnityEditor;
public class VRCPlayerModEditorWindow : EditorWindow {
public delegate void AddModCallback();
public static AddModCallback addModCallback;
private static VRCSDK2.VRC_PlayerMods myTarget;
private static VRCSDK2.VRCPlayerModFactory.PlayerModType type;
public static void Init (VRCSDK2.VRC_PlayerMods target, AddModCallback callback)
{
// Get existing open window or if none, make a new one:
EditorWindow.GetWindow (typeof (VRCPlayerModEditorWindow));
addModCallback = callback;
myTarget = target;
type = VRCSDK2.VRCPlayerModFactory.PlayerModType.Jump;
}
void OnGUI ()
{
type = (VRCSDK2.VRCPlayerModFactory.PlayerModType)EditorGUILayout.EnumPopup("Mods", type);
if(GUILayout.Button("Add Mod"))
{
VRCSDK2.VRCPlayerMod mod = VRCSDK2.VRCPlayerModFactory.Create(type);
myTarget.AddMod(mod);
addModCallback();
}
}
}
#endif