Skip to content

Commit 661fe58

Browse files
committed
perf: simplify PlayerPickMenu object creation
Setting 'parent' property immediately after object instantiation is inefficient
1 parent f67ac6f commit 661fe58

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

src/Utilities/PlayerPickMenu.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ public static void openPlayerPickMenu(List<NetworkedPlayerInfo> playerList, Il2C
2727
customAction = action;
2828

2929
//The menu is based off the shapeshifting menu
30-
playerpickMenu = Object.Instantiate(getShapeshifterMenu());
31-
32-
playerpickMenu.transform.SetParent(Camera.main.transform, false);
33-
playerpickMenu.transform.localPosition = new Vector3(0f, 0f, -50f);
30+
playerpickMenu = Object.Instantiate(getShapeshifterMenu(), Camera.main.transform, false);
31+
32+
playerpickMenu.transform.localPosition = new Vector3(0f, 0f, -50f);
3433
playerpickMenu.Begin(null);
3534
}
3635

@@ -49,4 +48,4 @@ public static NetworkedPlayerInfo customPPMChoice(string name, NetworkedPlayerIn
4948

5049
return customChoice;
5150
}
52-
}
51+
}

0 commit comments

Comments
 (0)