Global Variable[Solved]

Ive made a significant amount of progress, I am able to get the object information in the Update function and I’m able to see the Vector3 using Debug.Log()…but I cannot get this updated information in the OnGUI() function is there a way to make the Vector3 into a global variable so I can access it in the OnGUI() function? Here is my code:

using UnityEngine;
using System.Collections;
 
public class text : MonoBehaviour {
 
public SimpleCloudHandler other;
public Transform target;
public Vector3 screenPos;
 
void Start(){
        }
void Update () {
        Vector3 screenPos = camera.WorldToScreenPoint (target.position);
        Debug.Log (screenPos[0]);
    }
 
void OnGUI() {
        GUI.Label (new Rect(screenPos[0],screenPos[1],screenPos[2],50), "" + other.TextFunc());
        Debug.Log (screenPos[0]);
 
        }
    }

Thanks!

GUI uses screen space, transform is in 3d space. See Unity - Scripting API: Camera.WorldToScreenPoint.