Skip to content

Commit 3c215d9

Browse files
Fixed duplicating Monobehaviours not assigning unique identifiers
1 parent 443753d commit 3c215d9

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Prowl.Runtime/GameObject/MonoBehaviour.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class MonoBehaviour : EngineObject
2323
{
2424
private static readonly Dictionary<Type, bool> CachedExecuteAlways = new();
2525

26-
[SerializeField, HideInInspector]
26+
[SerializeField, HideInInspector, CloneField(CloneFieldFlags.IdentityRelevant)]
2727
private Guid _identifier = Guid.NewGuid();
2828

2929
[SerializeField, HideInInspector]
@@ -607,17 +607,12 @@ public void CopyTo(MonoBehaviour target)
607607

608608
public override void SetupCloneTargets(object targetObj, ICloneTargetSetup setup)
609609
{
610-
if (this == targetObj)
611-
System.Diagnostics.Debugger.Break();
612610
MonoBehaviour target = targetObj as MonoBehaviour;
613611
this.OnSetupCloneTargets(targetObj, setup);
614612
}
615613

616614
public override void CopyDataTo(object targetObj, ICloneOperation operation)
617615
{
618-
if (this == targetObj)
619-
System.Diagnostics.Debugger.Break();
620-
621616
MonoBehaviour target = targetObj as MonoBehaviour;
622617
if (!operation.Context.PreserveIdentity)
623618
target._identifier = _identifier;

0 commit comments

Comments
 (0)