Skip to content

Commit e92a3ca

Browse files
committed
feat(graph creation): can create new graphs externally now
1 parent dc3271b commit e92a3ca

File tree

6 files changed

+97
-91
lines changed

6 files changed

+97
-91
lines changed

Assets/com.fluid.dialogue/Editor/CreateDialogueGraph.cs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@ namespace CleverCrow.Fluid.Dialogues.Editors {
88
public static class CreateDialogueGraph {
99
[MenuItem("Assets/Create/Fluid/Dialogue/Graph", priority = 0)]
1010
public static void CreateAsset () {
11-
var graph = CreateGraph();
11+
var path = AssetDatabase.GetAssetPath(Selection.activeObject);
12+
CreateAsset(path, "Dialogue");
13+
14+
AssetDatabase.SaveAssets();
15+
}
16+
17+
/// <summary>
18+
/// Create a dialogue graph asset in a specific folder.
19+
/// Designed to create dialogue graphs through custom Unity editor scripts.
20+
/// You must call AssetDatabase.SaveAssets(); on your own to save the asset properly.
21+
/// </summary>
22+
public static DialogueGraph CreateAsset (string folderPath, string graphName) {
23+
var graph = CreateGraph(folderPath, graphName);
1224

1325
var root = ScriptableObject.CreateInstance<NodeRootData>();
1426
root.rect.position =
@@ -17,15 +29,15 @@ public static void CreateAsset () {
1729
graph.root = root;
1830

1931
AssetDatabase.AddObjectToAsset(root, graph);
20-
AssetDatabase.SaveAssets();
32+
33+
return graph;
2134
}
2235

23-
private static DialogueGraph CreateGraph () {
36+
private static DialogueGraph CreateGraph (string folderPath, string graphName) {
2437
var graph = ScriptableObject.CreateInstance<DialogueGraph>();
25-
graph.name = "Dialogue";
26-
var path = AssetDatabase.GetAssetPath(Selection.activeObject);
38+
graph.name = graphName;
2739
var assetsInPath = AssetDatabase
28-
.FindAssets("t:DialogueGraph", new[] {path})
40+
.FindAssets("t:DialogueGraph", new[] {folderPath})
2941
.Select(i => {
3042
var p = AssetDatabase.GUIDToAssetPath(i);
3143
var parts = p.Split('/');
@@ -40,7 +52,7 @@ private static DialogueGraph CreateGraph () {
4052
graph.name = $"{name}({count})";
4153
}
4254

43-
AssetDatabase.CreateAsset(graph, $"{path}/{graph.name}.asset");
55+
AssetDatabase.CreateAsset(graph, $"{folderPath}/{graph.name}.asset");
4456
return graph;
4557
}
4658
}

Packages/manifest.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,18 @@
1717
"com.fluid.unity-event-plus": "1.2.0",
1818
"com.unity.2d.sprite": "1.0.0",
1919
"com.unity.2d.tilemap": "1.0.0",
20-
"com.unity.ads": "4.3.0",
21-
"com.unity.analytics": "3.7.1",
22-
"com.unity.collab-proxy": "1.17.2",
23-
"com.unity.ext.nunit": "1.0.6",
24-
"com.unity.ide.rider": "3.0.15",
25-
"com.unity.ide.visualstudio": "2.0.16",
26-
"com.unity.ide.vscode": "1.2.5",
27-
"com.unity.purchasing": "4.4.1",
28-
"com.unity.test-framework": "1.1.33",
29-
"com.unity.textmeshpro": "3.0.6",
30-
"com.unity.timeline": "1.7.1",
31-
"com.unity.ugui": "1.0.0",
20+
"com.unity.ads": "4.4.2",
21+
"com.unity.ai.navigation": "2.0.0",
22+
"com.unity.analytics": "3.8.1",
23+
"com.unity.collab-proxy": "2.2.0",
24+
"com.unity.ext.nunit": "2.0.5",
25+
"com.unity.ide.rider": "3.0.28",
26+
"com.unity.ide.visualstudio": "2.0.22",
27+
"com.unity.purchasing": "4.10.0",
28+
"com.unity.test-framework": "1.3.9",
29+
"com.unity.timeline": "1.8.6",
30+
"com.unity.ugui": "2.0.0",
31+
"com.unity.modules.accessibility": "1.0.0",
3232
"com.unity.modules.ai": "1.0.0",
3333
"com.unity.modules.androidjni": "1.0.0",
3434
"com.unity.modules.animation": "1.0.0",

Packages/packages-lock.json

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,31 @@
5555
"version": "1.0.0",
5656
"depth": 0,
5757
"source": "builtin",
58-
"dependencies": {}
58+
"dependencies": {
59+
"com.unity.modules.tilemap": "1.0.0",
60+
"com.unity.modules.uielements": "1.0.0"
61+
}
5962
},
6063
"com.unity.ads": {
61-
"version": "4.3.0",
64+
"version": "4.4.2",
6265
"depth": 0,
6366
"source": "registry",
6467
"dependencies": {
6568
"com.unity.ugui": "1.0.0"
6669
},
6770
"url": "https://packages.unity.com"
6871
},
72+
"com.unity.ai.navigation": {
73+
"version": "2.0.0",
74+
"depth": 0,
75+
"source": "registry",
76+
"dependencies": {
77+
"com.unity.modules.ai": "1.0.0"
78+
},
79+
"url": "https://packages.unity.com"
80+
},
6981
"com.unity.analytics": {
70-
"version": "3.7.1",
82+
"version": "3.8.1",
7183
"depth": 0,
7284
"source": "registry",
7385
"dependencies": {
@@ -77,23 +89,21 @@
7789
"url": "https://packages.unity.com"
7890
},
7991
"com.unity.collab-proxy": {
80-
"version": "1.17.2",
92+
"version": "2.2.0",
8193
"depth": 0,
8294
"source": "registry",
83-
"dependencies": {
84-
"com.unity.services.core": "1.0.1"
85-
},
95+
"dependencies": {},
8696
"url": "https://packages.unity.com"
8797
},
8898
"com.unity.ext.nunit": {
89-
"version": "1.0.6",
99+
"version": "2.0.5",
90100
"depth": 0,
91101
"source": "registry",
92102
"dependencies": {},
93103
"url": "https://packages.unity.com"
94104
},
95105
"com.unity.ide.rider": {
96-
"version": "3.0.15",
106+
"version": "3.0.28",
97107
"depth": 0,
98108
"source": "registry",
99109
"dependencies": {
@@ -102,86 +112,69 @@
102112
"url": "https://packages.unity.com"
103113
},
104114
"com.unity.ide.visualstudio": {
105-
"version": "2.0.16",
115+
"version": "2.0.22",
106116
"depth": 0,
107117
"source": "registry",
108118
"dependencies": {
109119
"com.unity.test-framework": "1.1.9"
110120
},
111121
"url": "https://packages.unity.com"
112122
},
113-
"com.unity.ide.vscode": {
114-
"version": "1.2.5",
115-
"depth": 0,
116-
"source": "registry",
117-
"dependencies": {},
118-
"url": "https://packages.unity.com"
119-
},
120123
"com.unity.nuget.newtonsoft-json": {
121-
"version": "3.0.2",
124+
"version": "3.2.1",
122125
"depth": 2,
123126
"source": "registry",
124127
"dependencies": {},
125128
"url": "https://packages.unity.com"
126129
},
127130
"com.unity.purchasing": {
128-
"version": "4.4.1",
131+
"version": "4.10.0",
129132
"depth": 0,
130133
"source": "registry",
131134
"dependencies": {
132135
"com.unity.ugui": "1.0.0",
133-
"com.unity.modules.unityanalytics": "1.0.0",
134136
"com.unity.modules.unitywebrequest": "1.0.0",
135137
"com.unity.modules.jsonserialize": "1.0.0",
136138
"com.unity.modules.androidjni": "1.0.0",
137-
"com.unity.services.core": "1.3.1",
138-
"com.unity.services.analytics": "4.0.1"
139+
"com.unity.services.core": "1.8.2"
139140
},
140141
"url": "https://packages.unity.com"
141142
},
142143
"com.unity.services.analytics": {
143-
"version": "4.2.0",
144+
"version": "4.4.0",
144145
"depth": 1,
145146
"source": "registry",
146147
"dependencies": {
147148
"com.unity.ugui": "1.0.0",
148-
"com.unity.services.core": "1.4.0"
149+
"com.unity.services.core": "1.8.1",
150+
"com.unity.nuget.newtonsoft-json": "3.0.2"
149151
},
150152
"url": "https://packages.unity.com"
151153
},
152154
"com.unity.services.core": {
153-
"version": "1.4.2",
155+
"version": "1.12.2",
154156
"depth": 1,
155157
"source": "registry",
156158
"dependencies": {
157159
"com.unity.modules.unitywebrequest": "1.0.0",
158-
"com.unity.nuget.newtonsoft-json": "3.0.2",
160+
"com.unity.nuget.newtonsoft-json": "3.2.1",
159161
"com.unity.modules.androidjni": "1.0.0"
160162
},
161163
"url": "https://packages.unity.com"
162164
},
163165
"com.unity.test-framework": {
164-
"version": "1.1.33",
166+
"version": "1.3.9",
165167
"depth": 0,
166168
"source": "registry",
167169
"dependencies": {
168-
"com.unity.ext.nunit": "1.0.6",
170+
"com.unity.ext.nunit": "2.0.3",
169171
"com.unity.modules.imgui": "1.0.0",
170172
"com.unity.modules.jsonserialize": "1.0.0"
171173
},
172174
"url": "https://packages.unity.com"
173175
},
174-
"com.unity.textmeshpro": {
175-
"version": "3.0.6",
176-
"depth": 0,
177-
"source": "registry",
178-
"dependencies": {
179-
"com.unity.ugui": "1.0.0"
180-
},
181-
"url": "https://packages.unity.com"
182-
},
183176
"com.unity.timeline": {
184-
"version": "1.7.1",
177+
"version": "1.8.6",
185178
"depth": 0,
186179
"source": "registry",
187180
"dependencies": {
@@ -193,14 +186,20 @@
193186
"url": "https://packages.unity.com"
194187
},
195188
"com.unity.ugui": {
196-
"version": "1.0.0",
189+
"version": "2.0.0",
197190
"depth": 0,
198191
"source": "builtin",
199192
"dependencies": {
200193
"com.unity.modules.ui": "1.0.0",
201194
"com.unity.modules.imgui": "1.0.0"
202195
}
203196
},
197+
"com.unity.modules.accessibility": {
198+
"version": "1.0.0",
199+
"depth": 0,
200+
"source": "builtin",
201+
"dependencies": {}
202+
},
204203
"com.unity.modules.ai": {
205204
"version": "1.0.0",
206205
"depth": 0,
@@ -248,6 +247,12 @@
248247
"com.unity.modules.animation": "1.0.0"
249248
}
250249
},
250+
"com.unity.modules.hierarchycore": {
251+
"version": "1.0.0",
252+
"depth": 1,
253+
"source": "builtin",
254+
"dependencies": {}
255+
},
251256
"com.unity.modules.imageconversion": {
252257
"version": "1.0.0",
253258
"depth": 0,
@@ -337,17 +342,7 @@
337342
"com.unity.modules.ui": "1.0.0",
338343
"com.unity.modules.imgui": "1.0.0",
339344
"com.unity.modules.jsonserialize": "1.0.0",
340-
"com.unity.modules.uielementsnative": "1.0.0"
341-
}
342-
},
343-
"com.unity.modules.uielementsnative": {
344-
"version": "1.0.0",
345-
"depth": 1,
346-
"source": "builtin",
347-
"dependencies": {
348-
"com.unity.modules.ui": "1.0.0",
349-
"com.unity.modules.imgui": "1.0.0",
350-
"com.unity.modules.jsonserialize": "1.0.0"
345+
"com.unity.modules.hierarchycore": "1.0.0"
351346
}
352347
},
353348
"com.unity.modules.umbra": {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
%YAML 1.1
2+
%TAG !u! tag:unity3d.com,2011:
3+
--- !u!655991488 &1
4+
MultiplayerManager:
5+
m_ObjectHideFlags: 0
6+
m_EnableMultiplayerRoles: 0
7+
m_ActiveMultiplayerRole: 0

ProjectSettings/PackageManagerSettings.asset

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,35 @@ MonoBehaviour:
1212
m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
1313
m_Name:
1414
m_EditorClassIdentifier:
15-
m_EnablePreviewPackages: 0
16-
m_EnablePackageDependencies: 0
15+
m_EnablePreReleasePackages: 0
1716
m_AdvancedSettingsExpanded: 1
1817
m_ScopedRegistriesSettingsExpanded: 1
18+
m_SeeAllPackageVersions: 0
19+
m_DismissPreviewPackagesInUse: 0
1920
oneTimeWarningShown: 0
21+
oneTimeDeprecatedPopUpShown: 0
2022
m_Registries:
2123
- m_Id: main
2224
m_Name:
2325
m_Url: https://packages.unity.com
2426
m_Scopes: []
2527
m_IsDefault: 1
2628
m_Capabilities: 7
27-
- m_Id: scoped:NPM
29+
m_ConfigSource: 0
30+
- m_Id: scoped:project:NPM
2831
m_Name: NPM
2932
m_Url: https://registry.npmjs.org
3033
m_Scopes:
3134
- clever-crow
3235
- com.fluid
3336
m_IsDefault: 0
3437
m_Capabilities: 0
35-
m_UserSelectedRegistryName:
38+
m_ConfigSource: 4
39+
m_UserSelectedRegistryName: NPM
3640
m_UserAddingNewScopedRegistry: 0
3741
m_RegistryInfoDraft:
38-
m_ErrorMessage:
39-
m_Original:
40-
m_Id: scoped:NPM
41-
m_Name: NPM
42-
m_Url: https://registry.npmjs.org
43-
m_Scopes:
44-
- clever-crow
45-
- com.fluid
46-
m_IsDefault: 0
47-
m_Capabilities: 0
4842
m_Modified: 0
49-
m_Name: NPM
50-
m_Url: https://registry.npmjs.org
51-
m_Scopes:
52-
- clever-crow
53-
- com.fluid
54-
m_SelectedScopeIndex: 0
43+
m_ErrorMessage:
44+
m_UserModificationsInstanceId: -850
45+
m_OriginalInstanceId: -854
46+
m_LoadAssets: 0

ProjectSettings/ProjectVersion.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2022.1.16f1
2-
m_EditorVersionWithRevision: 2022.1.16f1 (7321c9670bc2)
1+
m_EditorVersion: 2023.2.10f1
2+
m_EditorVersionWithRevision: 2023.2.10f1 (316c1fd686f6)

0 commit comments

Comments
 (0)