Search Unity

How to use Camera with Attach component? (it needs Entity)

Discussion in 'Entity Component System' started by ryancole, Nov 21, 2018.

  1. ryancole

    ryancole

    Joined:
    Oct 8, 2017
    Posts:
    18
    Hi folks,

    I'm trying to make my Camera follow my player Entity around - typical third person camera hierarchy. I've got my player archetype and subsequent entity and then I have the default Main Camera in my scene. I've added the entity component to the camera which makes it an entity registered with ECS. Now, to use the Attach component I need to somehow get a reference to that Camera entity and then I can use it with Attach component elsewhere.

    I'm not sure how to get a single entity, though. Is there a way I can somehow get that camera entity directly?

    Thanks!
     
  2. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Make a public exposed field of type GameObjectEntity, drag your camera GOE to there and then you can goe.Entity