Skip to content

Commit

Permalink
fix: use transform values of target for replacing mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
MSchmoecker committed Mar 7, 2024
1 parent f74ee5e commit d04f08a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions JotunnLib/Managers/MockSystem/MockManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,16 @@ internal static void ReplaceMockGameObject(Transform child, GameObject realPrefa
return;
}

var newObject = Object.Instantiate(realPrefab, parent.transform);
newObject.name = realPrefab.name;
newObject.SetActive(child.gameObject.activeSelf);
newObject.transform.position = child.gameObject.transform.position;
newObject.transform.rotation = child.gameObject.transform.rotation;
newObject.transform.localScale = child.gameObject.transform.localScale;

int siblingIndex = child.GetSiblingIndex();
Object.DestroyImmediate(child.gameObject);

var newObject = Object.Instantiate(realPrefab, parent.transform);
newObject.transform.SetSiblingIndex(siblingIndex);
newObject.name.RemoveSuffix("(Clone)");
}

private static bool IsPersistent(GameObject parent) {
Expand Down

0 comments on commit d04f08a

Please sign in to comment.