Fixed current day of week calculation
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Utility
|
||||
{
|
||||
@ -23,7 +24,15 @@ namespace Utility
|
||||
else if (_instance != value)
|
||||
{
|
||||
Debug.LogError("Instance already exists. Deleting duplicate.");
|
||||
Destroy(value.gameObject);
|
||||
|
||||
if (Application.isEditor)
|
||||
{
|
||||
DestroyImmediate(value.gameObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(value.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,8 +50,11 @@ namespace Utility
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
// The value of Instance is lost after deserialization, so we need to set it again.
|
||||
Instance = (T)this;
|
||||
if (!Application.isEditor)
|
||||
{
|
||||
// The value of Instance is lost after deserialization, so we need to set it again.
|
||||
Instance = (T)this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user