mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
Update AssetsReference.cs
This commit is contained in:
@@ -66,13 +66,24 @@ namespace TEngine
|
|||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
// If it is a clone, clear the reference records before cloning
|
// If it is a clone, clear the reference records before cloning
|
||||||
if (!_originalRefs.ContainsKey(gameObject) || _originalRefs[gameObject] != this)
|
if (!IsOriginalInstance())
|
||||||
{
|
{
|
||||||
sourceGameObject = null;
|
ClearCloneReferences();
|
||||||
refAssetInfoList?.Clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsOriginalInstance()
|
||||||
|
{
|
||||||
|
return _originalRefs.TryGetValue(gameObject, out var originalComponent) &&
|
||||||
|
originalComponent == this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearCloneReferences()
|
||||||
|
{
|
||||||
|
sourceGameObject = null;
|
||||||
|
refAssetInfoList?.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
CheckInit();
|
CheckInit();
|
||||||
|
Reference in New Issue
Block a user