1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-20 17:26:02 +08:00

Null check changes

This commit is contained in:
Thor Kramer Brigsted 2017-11-29 09:16:48 +01:00
parent aabd2e4145
commit d15b55745d

View File

@ -6,9 +6,21 @@ using UnityEngine;
namespace XNodeEditor { namespace XNodeEditor {
public static class NodeEditorPreferences { public static class NodeEditorPreferences {
public static Texture2D gridTexture { get { VerifyLoaded(); return _gridTexture; } } public static Texture2D gridTexture {
get {
VerifyLoaded();
if (_gridTexture == null) _gridTexture = NodeEditorResources.GenerateGridTexture(_gridLineColor, _gridBgColor);
return _gridTexture;
}
}
private static Texture2D _gridTexture; private static Texture2D _gridTexture;
public static Texture2D crossTexture { get { VerifyLoaded(); return _crossTexture; } } public static Texture2D crossTexture {
get {
VerifyLoaded();
if (_crossTexture == null) _crossTexture = NodeEditorResources.GenerateCrossTexture(_gridLineColor);
return _crossTexture;
}
}
private static Texture2D _crossTexture; private static Texture2D _crossTexture;
/// <summary> Have we loaded the prefs yet </summary> /// <summary> Have we loaded the prefs yet </summary>
@ -121,8 +133,6 @@ namespace XNodeEditor {
//Load snap option //Load snap option
if (EditorPrefs.HasKey("unec_gridsnap")) _gridSnap = EditorPrefs.GetBool("unec_gridsnap"); if (EditorPrefs.HasKey("unec_gridsnap")) _gridSnap = EditorPrefs.GetBool("unec_gridsnap");
_gridTexture = NodeEditorResources.GenerateGridTexture(_gridLineColor, _gridBgColor);
_crossTexture = NodeEditorResources.GenerateCrossTexture(_gridLineColor);
NodeEditorWindow.RepaintAll(); NodeEditorWindow.RepaintAll();
prefsLoaded = true; prefsLoaded = true;
} }