Search Unity

Third Party Player Instantiate camera Put it in

Discussion in 'Multiplayer' started by kimkb3174, Aug 30, 2023.

  1. kimkb3174


    Feb 6, 2023
    I instantiate the player in PUN2 and then find the player in the camera update, and when I find the player with FindObject, I find the first thing I meet and other player objects are included, so how can I solve it

    public class CameraControl : MonoBehaviourPunCallbacks

    Vector3 _delta;

    Vector3 offset;

    Transform _player;

    void Update()
    _player = FindObjectOfType<PlayerControl>().transform;
    transform.position = _player.position + _delta;
    void CreateController()
    Transform spawnPoint = SpawnManager.Instance.GetSpawnPoint();

    GameObject playerToSpawn = playerPrefabs[0];
    var controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs",, spawnPoint.position, Quaternion.identity, 0, new object[] { PV.ViewID }); =;

    I want to find myself and assign a camera