Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity3D Cameras

Discussion in 'Scripting' started by aviles622, Dec 16, 2014.

  1. aviles622

    aviles622

    Joined:
    Oct 16, 2014
    Posts:
    21
    I am creating a horse racing game. I have 10 horses per race and fooling around with multiple cameras that can be changed during the race. For instance you can have a camera chasing any of the 10 horses from behind.

    The only way I can currently get it to work and it works great is by creating 10 camera objects and in design mode positioning and parenting each camera behind its horse object. Camera1 to Horse1, Camera2 to Horse2, Camera3 to Horse3 and so on. Only 1 camera is active at a time (of course) while the other 9 camera active properties are set to false. I am setting the active properties via script and its working great.

    I would love to keep it this way as its working flawlessly because Ive tried to only have one camera and tried to script that camera to parent to either horse during the race but its just never at the right position with whatever code I try to modify.

    My question is:
    Will having 10 different camera objects even though only 1 is active at a time punish the performance as I continue to develop my game with more assets and scripts?
     
    Last edited: Dec 16, 2014
  2. PrefabEvolution

    PrefabEvolution

    Joined:
    Mar 27, 2014
    Posts:
    225
    If you camera is disable this wont render anything and have not any perfomance penalty, i have try this with more that 1000 cameras at time.
     
    BBeck likes this.
  3. aviles622

    aviles622

    Joined:
    Oct 16, 2014
    Posts:
    21
    Thank You, PrefabEvolution for the generous and quick response! I'm gonna end up having about 20 cameras and now I'm not worried at all.