Hi Guys, having trouble getting a 2d math equation to show up in a secondary camera layer. The instantiated PowerUp object shows in the second layer, but the GUI, though a child object, appears in the camera.main. I’m using the same script to generate equations for the asteroid equations and the PowerUP equations, using a conditional to separate them out. Should I use and array of cameras for different GUI? Can I get a reference to a second camera on the fly like Camera.main ??? Not sure. Appreciate your brilliance and generosity.
if(m_quientGT)
{
m_quientGT.transform.position = Camera.main.WorldToViewportPoint(transform.position+quientOffset);
if (this.gameObject.tag == "PowerUp")
{
m_quientGT.transform.position = Camera.????????????.WorldToViewportPoint(transform.position+quientOffset);
}
}
Thanks for your help! This solution works sufficiently well. I was worried that it might be too expensive because so many asteroids get spawned and so few power-ups relatively. The added conundrum is that a laser targets the power-up, but does so in "real world" positioning, so that if the main camera/player is in a bizarre position––while the power-up looks awesome in the scene--the laser shoots it somewhere else....I may simply have to animate to the main camera instantiating the object relative to its position. Thanks again!
– tbrewerart