Search Unity

Camera problem

Discussion in 'Editor & General Support' started by Roirtur, Jun 22, 2019.

  1. Roirtur

    Roirtur

    Joined:
    Jun 18, 2019
    Posts:
    4
    Hello ! I'm trying to set a camera on my game but I have a problem, how can I get player position from a script attached to the camera ? or how can I moove the camera from a script attached to the player ?
    Please help me....
    Thank u :)
     
  2. ManuelSegura

    ManuelSegura

    Joined:
    Dec 12, 2015
    Posts:
    19
    References!

    In the player script write: public CameraScript camera;
    In the camera script write: public PlayerScript player;

    If you only want the position you can reference they transforms:

    In the player script write: public Transform cameraT;
    In the camera script write: public Transform playerT;

    Also, watch some Youtube tutorials before posting more questions, they are waaaay better general teachers than random forum posts, specially for beginners.