multiple xr toolkit package
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VRCPlayerModEditorWindow.cs 909B

12345678910111213141516171819202122232425262728293031323334
  1. // C# example:
  2. using UnityEngine;
  3. using UnityEditor;
  4. public class VRCPlayerModEditorWindow : EditorWindow {
  5. public delegate void AddModCallback();
  6. public static AddModCallback addModCallback;
  7. private static VRCSDK2.VRC_PlayerMods myTarget;
  8. private static VRCSDK2.VRCPlayerModFactory.PlayerModType type;
  9. public static void Init (VRCSDK2.VRC_PlayerMods target, AddModCallback callback)
  10. {
  11. // Get existing open window or if none, make a new one:
  12. EditorWindow.GetWindow (typeof (VRCPlayerModEditorWindow));
  13. addModCallback = callback;
  14. myTarget = target;
  15. type = VRCSDK2.VRCPlayerModFactory.PlayerModType.Jump;
  16. }
  17. void OnGUI ()
  18. {
  19. type = (VRCSDK2.VRCPlayerModFactory.PlayerModType)EditorGUILayout.EnumPopup("Mods", type);
  20. if(GUILayout.Button("Add Mod"))
  21. {
  22. VRCSDK2.VRCPlayerMod mod = VRCSDK2.VRCPlayerModFactory.Create(type);
  23. myTarget.AddMod(mod);
  24. addModCallback();
  25. }
  26. }
  27. }