Skip to content

Commit c86ceb8

Browse files
committed
Add appropriate types to assets in ExportSettings
Also reflect these changes in methods using them
1 parent b71ef3f commit c86ceb8

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

Disunity/Disunity.Editor/Editors/ExportEditor.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using System;
22
using System.Linq;
3-
using Disunity.Core;
43
using Disunity.Editor.Fields;
54
using UnityEditor;
5+
using UnityEditorInternal;
66
using UnityEngine;
7-
using Object = UnityEngine.Object;
8-
97

108
namespace Disunity.Editor.Editors {
119

@@ -73,7 +71,7 @@ private void DrawContentWarning(ExportSettings settings) {
7371
}
7472
}
7573

76-
private void DrawStartupSelector(ClassPickerField field, Object[] assemblies, string currentClass, string currentAssembly, Action<string, string> handler, string labelText) {
74+
private void DrawStartupSelector(ClassPickerField field, AssemblyDefinitionAsset[] assemblies, string currentClass, string currentAssembly, Action<string, string> handler, string labelText) {
7775
if (assemblies.Length == 0) {
7876
return;
7977
}

Disunity/Disunity.Editor/Export.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5-
using System.Security.Cryptography;
65
using Disunity.Core;
76
using UnityEditor;
7+
using UnityEditorInternal;
88
using UnityEngine;
9-
using Object = System.Object;
10-
119

1210
namespace Disunity.Editor {
1311

@@ -52,7 +50,7 @@ private void CreateTempDirectory() {
5250
Directory.CreateDirectory(_tempModDirectory);
5351
}
5452

55-
private List<string> ExportAssemblies(UnityEngine.Object[] assemblies, string folder) {
53+
private List<string> ExportAssemblies(AssemblyDefinitionAsset[] assemblies, string folder) {
5654
var destinations = new List<string>();
5755
if (assemblies.Length == 0) return destinations;
5856
var destinationPath = Path.Combine(_tempModDirectory, folder);

Disunity/Disunity.Editor/ExportSettings.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
using Disunity.Core;
2+
using UnityEditor;
3+
using UnityEditorInternal;
24
using UnityEngine;
35

4-
56
namespace Disunity.Editor {
67

78
public class ExportSettings : ScriptableObject {
8-
99
/// <summary>
1010
/// The Mod's name.
1111
/// </summary>
@@ -29,13 +29,13 @@ public class ExportSettings : ScriptableObject {
2929
/// <summary>
3030
/// The directory to which the Mod will be exported.
3131
/// </summary>
32-
[field: SerializeField] public Object[] PreloadAssemblies { get; set; } = { };
32+
[field: SerializeField] public AssemblyDefinitionAsset[] PreloadAssemblies { get; set; } = { };
3333

34-
[field: SerializeField] public Object[] RuntimeAssemblies { get; set; } = { };
34+
[field: SerializeField] public AssemblyDefinitionAsset[] RuntimeAssemblies { get; set; } = { };
3535

3636
[field: SerializeField] public Object[] Artifacts { get; set; } = { };
37-
[field: SerializeField] public Object[] Prefabs { get; set; } = { };
38-
[field: SerializeField] public Object[] Scenes { get; set; } = { };
37+
[field: SerializeField] public GameObject[] Prefabs { get; set; } = { };
38+
[field: SerializeField] public SceneAsset[] Scenes { get; set; } = { };
3939

4040
[field: SerializeField] public string OutputDirectory { get; set; }
4141

Disunity/Disunity.Editor/Fields/ClassPickerField.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ namespace Disunity.Editor.Fields {
1010

1111
public class ClassPickerField : BasePickerField<GenericEntry, FilteredPicker> {
1212

13-
protected Dictionary<string, Type> GetTypesFromAssemblies(Object[] options) {
13+
protected Dictionary<string, Type> GetTypesFromAssemblies(AssemblyDefinitionAsset[] options) {
1414
var types = new Dictionary<string, Type>();
15-
var assemblies = options.Select(o => ( (AssemblyDefinitionAsset)o ).name);
15+
var assemblies = options.Select(o => o.name);
1616

1717
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
1818
if (!assemblies.Contains(assembly.GetName().Name)) {
@@ -32,7 +32,7 @@ protected List<IEntry> GetEntries(string[] names) {
3232
return new List<IEntry>(entries);
3333
}
3434

35-
public void OnGUI(string currentClass, string currentAssembly, Object[] assemblies, Action<string, string> handler) {
35+
public void OnGUI(string currentClass, string currentAssembly, AssemblyDefinitionAsset[] assemblies, Action<string, string> handler) {
3636
var types = new Dictionary<string, Type>();
3737

3838
List<IEntry> Generator() {

0 commit comments

Comments
 (0)