Search Unity

Cinemachine follow player "TAG"

Discussion in 'Cinemachine' started by EmpireStudios, Oct 23, 2018.

  1. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    Hi, does anyone know how to make the virtual camera automatically add the Player to the follow component in the inspector? Like have it detect the game object with the tag player or layer player. I'm not a coder so any help would be great. This would help for a player selection scene i think. This way whatever character is chosen the camera will follow right?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    The vcam won't do that out of the box because we don't want to make too many assumptions about how the tool will be used.

    You'll have to write a little initialization script that searches for the Player tag and assigns the resulting object to the vcam's LookAt and Follow fields.
     
  3. EmpireStudios

    EmpireStudios

    Joined:
    Oct 23, 2018
    Posts:
    24
    I was afraid of that, its a bit over my head but thank you.
     
  4. DeanMarquette

    DeanMarquette

    Joined:
    Feb 10, 2015
    Posts:
    165
    Oh wow, I was able to do this with Playmaker. I'm getting pretty good at this.