狗屎Minimax坏我代码
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using SickscoreGames;
|
||||
|
||||
namespace SickscoreGames.HUDNavigationSystem
|
||||
{
|
||||
@@ -14,11 +11,12 @@ namespace SickscoreGames.HUDNavigationSystem
|
||||
public static HUDNavigationCanvas Instance {
|
||||
get {
|
||||
if (_Instance == null) {
|
||||
_Instance = FindObjectOfType<HUDNavigationCanvas> ();
|
||||
_Instance = HUDNavigationExtensions.FindFirst<HUDNavigationCanvas> ();
|
||||
}
|
||||
return _Instance;
|
||||
}
|
||||
}
|
||||
private bool _instanceHasChanged = false;
|
||||
|
||||
|
||||
#region Variables
|
||||
@@ -43,9 +41,11 @@ namespace SickscoreGames.HUDNavigationSystem
|
||||
#region Main Methods
|
||||
void Awake ()
|
||||
{
|
||||
if (_Instance != null) {
|
||||
Destroy (this.gameObject);
|
||||
return;
|
||||
// destroy canvas instance, if current scene has it's own HNS canvas
|
||||
if (_Instance != null)
|
||||
{
|
||||
Destroy(_Instance.gameObject);
|
||||
_instanceHasChanged = true;
|
||||
}
|
||||
|
||||
_Instance = this;
|
||||
@@ -61,6 +61,12 @@ namespace SickscoreGames.HUDNavigationSystem
|
||||
// dont destroy on load
|
||||
if (_HUDNavigationSystem != null && _HUDNavigationSystem.KeepAliveOnLoad)
|
||||
DontDestroyOnLoad (this.gameObject);
|
||||
|
||||
// re-init all HNS components
|
||||
if (_HUDNavigationSystem != null && _instanceHasChanged) {
|
||||
_instanceHasChanged = false;
|
||||
_HUDNavigationSystem.ChangeCanvas(Instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user