-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPackageRemover.cs.template
More file actions
78 lines (55 loc) · 2.11 KB
/
PackageRemover.cs.template
File metadata and controls
78 lines (55 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//2019 Levi D. Smith
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;
public static class PackageRemover {
static RemoveRequest myRequest;
static Queue<string> myQueue;
[MenuItem("Build/Package Remover")]
public static void RemovePackages() {
Debug.Log("Remove Packages");
string strPackage;
myQueue = new Queue<string>();
strPackage = "com.unity.textmeshpro";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.ads";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.analytics";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.purchasing";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.collab-proxy";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.multiplayer-hlapi";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.timeline";
myQueue.Enqueue(strPackage);
strPackage = "com.unity.xr.legacyinputhelpers";
myQueue.Enqueue(strPackage);
EditorApplication.update += Progress;
EditorApplication.LockReloadAssemblies();
string strNextReq = myQueue.Dequeue();
Debug.Log("Removing: " + strNextReq);
myRequest = Client.Remove(strNextReq);
}
static void Progress() {
if (myRequest.IsCompleted) {
if (myRequest.Status == StatusCode.Success) {
Debug.Log("Removed: " + myRequest.PackageIdOrName);
} else if (myRequest.Status >= StatusCode.Failure) {
Debug.Log(myRequest.Error.message);
}
if (myQueue.Count > 0) {
string strNextReq = myQueue.Dequeue();
Debug.Log("Removing: " + strNextReq);
myRequest = Client.Remove(strNextReq);
} else {
EditorApplication.update -= Progress;
EditorApplication.UnlockReloadAssemblies();
}
}
}
}