升级6.4.升级水,升级天气
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
// Crest Water System
|
||||
// Copyright © 2024 Wave Harmonic. All rights reserved.
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
#if UNITY_EDITOR
|
||||
using MonoBehaviour = WaveHarmonic.Crest.Internal.EditorBehaviour;
|
||||
#else
|
||||
using MonoBehaviour = UnityEngine.MonoBehaviour;
|
||||
@@ -14,7 +15,7 @@ namespace WaveHarmonic.Crest.Internal
|
||||
/// <summary>
|
||||
/// Implements logic to smooth out Unity's wrinkles.
|
||||
/// </summary>
|
||||
public abstract class CustomBehaviour : MonoBehaviour
|
||||
public abstract partial class CustomBehaviour : MonoBehaviour
|
||||
{
|
||||
bool _AfterStart;
|
||||
|
||||
@@ -71,11 +72,46 @@ namespace WaveHarmonic.Crest.Internal
|
||||
[InitializeOnEnterPlayMode]
|
||||
static void OnEnterPlayModeInEditor(EnterPlayModeOptions options)
|
||||
{
|
||||
foreach (var @object in FindObjectsByType<CustomBehaviour>(FindObjectsInactive.Include, FindObjectsSortMode.None))
|
||||
foreach (var @object in Helpers.FindObjectsByType<CustomBehaviour>(FindObjectsInactive.Include))
|
||||
{
|
||||
@object._AfterStart = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
partial class CustomBehaviour : ISerializationCallbackReceiver
|
||||
{
|
||||
#pragma warning disable 414
|
||||
[@SerializeField, @HideInInspector]
|
||||
private protected int _Version;
|
||||
#pragma warning restore 414
|
||||
|
||||
private protected virtual int Version => 0;
|
||||
|
||||
private protected CustomBehaviour()
|
||||
{
|
||||
// Sets the default version. Overriden by serialized field above.
|
||||
_Version = Version;
|
||||
}
|
||||
|
||||
private protected virtual void OnMigrate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnBeforeSerialize()
|
||||
{
|
||||
if (_Version < Version)
|
||||
{
|
||||
OnMigrate();
|
||||
_Version = Version;
|
||||
}
|
||||
}
|
||||
|
||||
void ISerializationCallbackReceiver.OnAfterDeserialize()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user