# Using multiple cameras with different GUI assets??

**URL:** https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379
**Category:** Camera
**Tags:** Scripting
**Created:** [December 2, 2011, 8:20pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379 "2011-12-02T20:20:36Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 2, 2011, 8:20pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/1 "2011-12-02T20:20:36Z")

</div>

I am using the multi-camera code from the wiki, and I can’t isolate the GUI HUD fromt he main camera to the other 3 cameras. Every one of them have the same thing even thou the code isn’t on all of them, and I have them tagged, to try and isolate them, but it isn’t working???

Any tips??

---

<div class="post-metadata">

### Author: ![KelsoMRK](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kelsomrk/32/205687_2.png) [@KelsoMRK](https://discussions.unity.com/u/KelsoMRK)
#### Post date: [December 2, 2011, 8:48pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/2 "2011-12-02T20:48:11Z")

</div>

What do you mean by isolate and “every one of them have the same thing”?

Typically, multiple cameras aren’t going to net you anything if you are using Unity’s GUI. The only time I ever use this setup is if I am using GameObjects to do GUI element positioning via WorldToScreenPoint(). (Handy if you need to animate your GUI elements).

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 2, 2011, 9:04pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/3 "2011-12-02T21:04:41Z")

</div>

I have a plain crosshair in my main camera, which is basically the 3rd person view, then I have a camera that I want to use for a sighted view and if I try and blacken it out sept for a sight hole with a reticle it shows up on my main camer too.

Can you explain how you use gameobjects to setup the GUI positions??

Don’t under stand why all GUI elemnts show up in all the cameras.

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 12:40pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/4 "2011-12-03T12:40:37Z")

</div>

I’ve been trying to figure this out all night…

---

<div class="post-metadata">

### Author: ![acropole](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@acropole](https://discussions.unity.com/u/acropole)
#### Post date: [December 3, 2011, 12:54pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/5 "2011-12-03T12:54:20Z")

</div>

Take a look there at the “depth only” part :  
[http://unity3d.com/support/documentation/Components/class-Camera.html](http://unity3d.com/support/documentation/Components/class-Camera.html)

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 1:00pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/6 "2011-12-03T13:00:56Z")

</div>

I already read all that about five times…doesn’t really help me. I tried masking and all that and can’t figure it out…

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 1:47pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/7 "2011-12-03T13:47:50Z")

</div>

I’ve tried layers and nothing works.

I attached a script with OnGUI to one camera and it shows in all 4 cameras. I have all the cameras tagged.

Am I missing something simple here???

---

<div class="post-metadata">

### Author: ![anon\_68001302](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon\_68001302](https://discussions.unity.com/u/anon_68001302)
#### Post date: [December 3, 2011, 9:26pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/8 "2011-12-03T21:26:28Z")

</div>

I would disable the gui when you swap cameras and enable a different one for the next camera.

What you trying to accomplosh with it?

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 9:31pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/9 "2011-12-03T21:31:06Z")

</div>

There is going to be things on the main(3rd person)camera as the HUD- then when you switch cameras to the camera which is for the gun sight I don’t want all the hud information there, which it is doing.

Not sure if you can disable the GUI like that, but thats why I need help. Cant find any info on how to do it.

---

<div class="post-metadata">

### Author: ![anon\_68001302](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon\_68001302](https://discussions.unity.com/u/anon_68001302)
#### Post date: [December 3, 2011, 9:39pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/10 "2011-12-03T21:39:32Z")

</div>

Are you doing ongui() stuff?

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 9:46pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/11 "2011-12-03T21:46:06Z")

</div>

Rgr that-What are you doing…lol

---

<div class="post-metadata">

### Author: ![anon\_68001302](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon\_68001302](https://discussions.unity.com/u/anon_68001302)
#### Post date: [December 3, 2011, 9:51pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/12 "2011-12-03T21:51:07Z")

</div>

Replying to your posts 😛

Id look into something like inside the camera code. Similar to this.

> **[hiding gui button](https://discussions.unity.com/questions/177447/hiding-gui-button.html)**
>
> function OnGUI() { if (weapon \>= 1) code to hide gui button; } what do i put there to hide the gui button, on lower screen resolutions the buttons take up half the screen and they are only used once

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 9:53pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/13 "2011-12-03T21:53:08Z")

</div>

What is the code to hide the GUI elements though???

---

<div class="post-metadata">

### Author: ![anon\_68001302](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon\_68001302](https://discussions.unity.com/u/anon_68001302)
#### Post date: [December 3, 2011, 9:55pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/14 "2011-12-03T21:55:29Z")

</div>

That code shows it, copy your gui code to it.

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 9:57pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/15 "2011-12-03T21:57:45Z")

</div>

LOL- that won’t work, it just says code to hide your gui; not the actual code…

---

<div class="post-metadata">

### Author: ![anon\_68001302](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anon\_68001302](https://discussions.unity.com/u/anon_68001302)
#### Post date: [December 3, 2011, 10:04pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/16 "2011-12-03T22:04:29Z")

</div>

Scroll down and read the answer on that link lol

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 3, 2011, 10:07pm UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/17 "2011-12-03T22:07:49Z")

</div>

THis is what the answer says

```auto
if(weapon < 1)
{
    code to show GUI button
}

```

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 4, 2011, 10:16am UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/18 "2011-12-04T10:16:12Z")

</div>

Is there a way to disable the rendering of GUI elements??

---

<div class="post-metadata">

### Author: ![bdev](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@bdev](https://discussions.unity.com/u/bdev)
#### Post date: [December 4, 2011, 10:24am UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/19 "2011-12-04T10:24:37Z")

</div>

Disable or remove the GUIFilter component off the cameras you do not want to render gui. ( this does not apply to UnityGUI, just GUIElements )

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [December 4, 2011, 10:29am UTC](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379/20 "2011-12-04T10:29:26Z")

</div>

Well I am using GUI labels and backgrounds and they are showing up in all the cameras. I tried getting rid of the guilayer deal and they still show up.

There has to be a way to use different gui elements on different cameras…right???

[Next page](https://discussions.unity.com/t/using-multiple-cameras-with-different-gui-assets/462379.md?page=2)
