Hello forum. My 3D game’s camera is being rendered through a tiny render texture to give it those big crunchy pixels. I have a canvas with a raw image in it that has the render texture assigned. I also have another canvas that has all my UI elements in it. I’m trying to have some of those UI elements, such as chat bubbles, appear over my game objects but I’m having trouble getting my object positions now that I’m using this render texture/raw image technique.
I have this function below that is called in Update(). Basically it’s setting the chat bubble UI on top of the character’s head. However, when I apply my render texture to my camera and raw image, the character’s coordinates are no longer correct and the chat bubble doesn’t appear over their heads properly. Does anyone know how I can solve this? My Canvas is currently set to Overlay if anyone is wondering. Thanks!
private void SetDialoguePosition(GameObject character)
{
// Retrieve the position of the NPC's DialogPosition object
Transform characterPosition = character.transform.Find("DialogPosition");
// Set chat bubble's position to the NPC's position
this.transform.position = cam.WorldToScreenPoint(characterPosition.position);
}