Help with inheritance to show GUI

I have an object, and I am trying to get its transform.position from one script attached to it into another script that controls the GUI. Tried using get/set method and called that function in the GUI script but to no avail.

I’m trying to get the position of a projectile to appear on screen. I already have a transform.rotation for an object that the GUI script is attached to showing on screen.

Problem is the position of the projectile is not so easily accessible, hence I am trying to use inheritance.

Any help would be appreciated, thank you!

Not seeing your code, you shouldn’t need get/set nor inheritance. However you are getting transform.rotation, it’s the same, transform.position.


public Transform xform; // you set this in code or drag in Inspector

void OnGUI()
  // set up box1 and box2 in Start
  GUI.Label (box1, xform.rotation.ToString());
  GUI.Label (box2, xform.position.ToString());