Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Dynamically update integers between different windows and scripts? in C#?

Discussion in 'Editor & General Support' started by shabazzster, Jul 24, 2011.

  1. shabazzster

    shabazzster

    Joined:
    Mar 17, 2010
    Posts:
    104
    Hey all, I have a very simple task but can't seem to find the Answer any where. I need to pass the total amount of money remaining from the shopping GUI display into the Money HUD (guiLabel) display. The Shop display is on a different script then the HUD display. .It is this way because the shopping display only displays when you enter a shop, and the Money HUD display is always visible, so that you can always know how much money you have. I need for the shop total to dynamically update the Money HUD total when ever i go shopping. The shopping total is a labeld display and the Money Hud is also a labeled display.

    enter code here
    public int Shoppingtotal;

    GUI.Label(new Rect(150,80,700,20),""+Shopping total); // i need this total to dynamically update into

    ;

    ;

    public int MoneyHUD;

    GUI.Label(new Rect(150,80,700,20),""+MoneyHUD); // into this total which is found in another script.

    thank you very much!
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
  3. shabazzster

    shabazzster

    Joined:
    Mar 17, 2010
    Posts:
    104
    Thanks hippocoder...it worked like a charm!