- Home /
Keep hud between cameras
I have a Timer, a Coin counter and a few other things in my hud. I want to keep it between both of my cameras. Here is my code:
public Camera Camera1;
public Camera Camera2;
public bool iscamera;
void Start () {
iscamera = true;
}
![alt text][1]
void Update () {
}
void OnTriggerEnter2D(Collider2D collision)
{
if (collision.gameObject.CompareTag("Player") || collision.gameObject.CompareTag("Ally"))
{
if (iscamera == true)
{
Camera1.gameObject.active = false;
Camera2.gameObject.active = true;
iscamera = false;
Debug.Log("Trocou de Camera(1-2)");
}
}
}
void OnTriggerExit2D(Collider2D collision) {
if (collision.gameObject.CompareTag("Player") || collision.gameObject.CompareTag("Ally"))
{
if (iscamera == false)
{
Camera1.gameObject.active = true;
Camera2.gameObject.active = false;
iscamera = true;
Debug.Log("Trocou de Camera(2-1)");
}
}
}
}
that is my Hud, I'm new programming so I used common sprites to the "Collectibles" (when player takes it in game it will change the sprite alpha on the hud.
if you take a look on the image keep in mind that Cartas = Letters
sem-titulo.png
(15.0 kB)
Comment
Your answer
Follow this Question
Related Questions
Isometric camera skybox not working. 0 Answers
Problem with Minimap. 3 Answers
Multiple Cars not working 1 Answer
rozmazana platforma,split graphics 0 Answers
Distribute terrain in zones 3 Answers