Fixed current day of week calculation

This commit is contained in:
Simon Lübeß
2024-04-05 13:54:38 +02:00
parent 81cbff9cab
commit b42ba4a9b1
13 changed files with 1981 additions and 187 deletions

View File

@ -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;
}
}
}
}