This script will be attached to a guiTexture called closeButton, that I want to be the Red X that sits at the top right of an inventory, and when clicked, it will close the inventory. When the player moves the inventories’ location, I want the X button (closeButton) to relocate itself based on the location of the inventory. The location of the inventory is programmed in a script called InventoryLocationScript. I am creating a new script, and need to reference the location of the inventory from the other script.
How would I get this code to work? (There is a small chance that it already works, but I am at work and cannot try it)
var closeButton: GUITexture;
function Update () {
{
closeButton.transform.position=inventory.GetComponent(InventoryLocationScript).Update(inventory.transform.position);
}
Or, if there is a better way to reference the location of an object from another script, please let me know! Thanks for reading.