Skip to content

Commit 6566bde

Browse files
committed
Change name and parent of players
1 parent 0df6125 commit 6566bde

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

Assets/_Project/Scripts/Player/PlayerManager.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ public void CreateNewPlayer(string username)
5151
spawnRotation.eulerAngles = new Vector3(0.0f, Random.Range(0.0f, 360.0f));
5252
if (spawnPosition != Vector3.zero)
5353
{
54+
// instantiate prefab @ spawn position
5455
GameObject obj = (GameObject)Instantiate(playerPrefab, spawnPosition, spawnRotation);
55-
56-
56+
// call Init() on Player
5757
obj.GetComponent<Player>().Init(username);
58+
// set name in Unity Editor
59+
obj.name = username;
60+
// parent under PlayerManger
61+
obj.transform.parent = gameObject.transform;
5862
// add to dict
5963
playerDictionary.Add(username, obj);
6064

Library/ArtifactDB

0 Bytes
Binary file not shown.

Library/SourceAssetDB

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)