Skip to content

Commit 80b9ff4

Browse files
author
Malte Weiß
committed
Fixes project not building
1 parent 1517a0d commit 80b9ff4

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
[Oo]bj/
44
[Bb]uild/
55
[Bb]uilds/
6+
.idea/
67
Assets/AssetStoreTools*
8+
Logs/
79

810
# Visual Studio cache directory
911
.vs/

Assets/Scripts/NullReferenceDetection/PreferencesSerialization.cs renamed to Assets/Scripts/NullReferenceDetection/Editor/PreferencesSerialization.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using System.Collections.Generic;
22
using System.IO;
33
using System.Linq;
4-
using UnityEditor;
54
using UnityEngine;
5+
using UnityEditor;
66

77
namespace NullReferenceDetection
88
{
@@ -70,11 +70,11 @@ public static IEnumerable<BlacklistItem> LoadIgnoreList()
7070

7171
var name = line.Substring(0, line.Length - 2);
7272

73-
if (line[line.Length - 1] == '1')
73+
if (line[^1] == '1')
7474
{
7575
ignoreList.Add(new BlacklistItem(name, ignoreChildren: true));
7676
}
77-
if (line[line.Length - 1] == '0')
77+
if (line[^1] == '0')
7878
{
7979
ignoreList.Add(new BlacklistItem(name, ignoreChildren: false));
8080
}
@@ -144,6 +144,11 @@ public static IEnumerable<GameObject> LoadPrefabList()
144144
{
145145
var line = reader.ReadLine();
146146

147+
if (line == null)
148+
{
149+
continue;
150+
}
151+
147152
if (line.Trim().Length == 0)
148153
{
149154
continue;

Assets/Scripts/NullReferenceDetection/ExtensionMethods.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ public static IEnumerable<Component> AllComponents(this GameObject gameObject)
1515

1616
public static IEnumerable<FieldInfo> GetInspectableFields(this Component component)
1717
{
18-
var type = component.GetType();
18+
var componentType = component.GetType();
1919
var inspectableFields = new List<FieldInfo>();
2020

21-
var publicFields = type.GetFields(BindingFlags.Public | BindingFlags.Instance).ToList();
22-
var privateFields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance).ToList();
21+
var publicFields = componentType.GetFields(BindingFlags.Public | BindingFlags.Instance).ToList();
22+
var privateFields = componentType.GetFields(BindingFlags.NonPublic | BindingFlags.Instance).ToList();
2323

24-
//Private fields can be inspected if they are explicitly serialized
24+
// Private fields can be inspected if they are explicitly serialized
2525
privateFields = privateFields.Where(f => f.HasAttribute<SerializeField>()).ToList();
26-
//Add remaining private and public fields to the list of all inspectable fields
26+
27+
// Add remaining private and public fields to the list of all inspectable fields
2728
inspectableFields.AddRange(publicFields);
2829
inspectableFields.AddRange(privateFields);
29-
//Remove fields that should be hidden in the inspector
30+
31+
// Remove fields that should be hidden in the inspector
3032
inspectableFields = inspectableFields.Where(f => !f.HasAttribute<HideInInspector>()).ToList();
3133

3234
return inspectableFields;

0 commit comments

Comments
 (0)