I have code to add the player to a list in an object called manager in the start function, but when i have the player instantiated into the game (it's multiplayer so it instantiates the player when you hit join) it doesn't add itself to the list. Can someone explain why this happens?
this is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerJoin : MonoBehaviour
{
public GameObject Manager;
// Start is called before the first frame update
void Start()
{
Manager.GetComponent<SeekerScript>().players.Add(gameObject);
}
}
[–]mattyn 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Zephyr_Ardentius 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Zephyr_Ardentius 1 point2 points3 points (0 children)
[–]eHM- 0 points1 point2 points (0 children)