- Home /
How do you keep text inside miniCams
Hi, I have 1 Main Camera and 10 mini cams. All 10 cams are lined up from top 0 to 9 bottom. I like to place the parent name inside the mini cams (child object) bottom center location. I added gui text to mini cam, but the text show in the main camera screen area. Each mini cam has its own name, so if you move the cam, like from position 3 to position 9, the text needs to follow the cam without it staying in position 3.
I currently have made this script.
void OnGUI () {
string theName = transform.parent.gameObject.name; // Gets the name of the parent from this child object.
GUI.contentColor = new Color(colorR, colorG, colorB, Antialiasing); // Just as it says.
GUI.Box(new Rect(nameSetup.top, nameSetup.left, nameSetup.width, nameSetup.height), theName, styleOSD); // Postitions the Name Text.
GUIUtility.ScaleAroundPivot (new Vector2(Screen.width/2560f,Screen.height/1600f),Vector2.zero); // Scales all GUI text according to screen size.
}
And for some reason the gui text did not scale. The text all stayed at font size of 12.
When moving the cams, the text does not move, its stuck on the main camera and not the mini cams on which I have the script attached. I don't get it, I have the script on mini cam, but it sure looks or feels like the script is attached to the main camera.
Thanks for looking and helping, David