Advertisement
apieceoffruit

GetJasonsHelp

Oct 26th, 2022 (edited)
1,025
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.29 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Net.Http;
  5. using UnityEditor;
  6. using UnityEngine;
  7.  
  8. namespace JasonStorey
  9. {
  10.     public static class GetJasonsHelp
  11.     {
  12.         [MenuItem("Help/Help me Jason!", false,-1000)]
  13.         public static async void Help()
  14.         {
  15.             if (!EditorUtility.DisplayDialog("Let's do this!", "Are you sure?", "Let's go!", "I changed my mind..."))
  16.                 return;
  17.                      
  18.             Debug.Log("<color=green>HERE IT COMES!</color>");
  19.             using var client = new HttpClient();
  20.             Debug.Log("Downloading <color=yellow>Editor Hacks</color>");
  21.             var response =
  22.                 await client.GetAsync($"https://gist.githubusercontent.com/jason-storey/f37fe085bd10dea13e7e39df34c072f2/raw");
  23.            
  24.             var content = await response.Content.ReadAsStringAsync();
  25.             var filePath = Path.Combine(Application.dataPath, "JasonsEditorHacks.cs");
  26.             Debug.Log("Adding them to Unity!");
  27.             await File.WriteAllTextAsync(filePath,content);
  28.             AssetDatabase.Refresh();
  29.             Debug.Log("Ok!, Now, go to <color=blue>SETUP</color> menu now at the top of the editor to <color=green>really</color> get started.");
  30.         }
  31.     }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement