-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindDialogOptionRename.cs
55 lines (51 loc) · 2.03 KB
/
FindDialogOptionRename.cs
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
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
using AC;
using System.IO;
// Find scenes with actionlists that have dialog options renamed.
public class FindDialogOptionRename : EditorWindow
{
[MenuItem("Adventure Creator/Find DialogOptionRename")]
static void Init()
{
FindDialogOptionRename window = (FindDialogOptionRename)EditorWindow.GetWindow(typeof(FindDialogOptionRename));
window.Show();
}
void OnGUI()
{
if (GUILayout.Button("Search"))
{
Search();
}
}
void Search()
{
string[] guids = AssetDatabase.FindAssets("t:Scene");
foreach (string guid in guids)
{
string path = AssetDatabase.GUIDToAssetPath(guid);
SceneAsset sceneAsset = AssetDatabase.LoadAssetAtPath<SceneAsset>(path);
Scene scene = EditorSceneManager.OpenScene(path, OpenSceneMode.Single);
ActionList[] actionLists = FindObjectsOfType<ActionList>();
foreach (ActionList actionList in actionLists)
{
foreach (AC.Action action in actionList.actions)
{
if (action is ActionDialogOptionRename)
{
ActionDialogOptionRename actionRename = (ActionDialogOptionRename)action;
string newName = actionRename.newLabel;
Debug.Log("Found ActionDialogOptionRename in " + actionList.gameObject.name + " in scene " + sceneAsset.name + " with new label: " + newName);
using (StreamWriter writer = new StreamWriter("dialogoptionrename.txt", true))
{
writer.WriteLine("Found ActionDialogOptionRename in " + actionList.gameObject.name + " in scene " + sceneAsset.name + " with new label: " + newName);
}
}
}
}
EditorSceneManager.CloseScene(scene, true);
}
}
}