Add numbers to a GUI.Label from another GUI.label?

using UnityEngine;
using System.Collections;

public class CharCreation : MonoBehaviour 
	{

	public string lanistaName = "";
	public string lanistaAge = "";
	public GUIStyle myGUIStyle;
	public float lanistaPoints = 10;
	public float charismaPoints = 15;
	public GUISkin charCreationSkin;


	// Use this for initialization
	void Start () 
	{
	

	}
	
	// Update is called once per frame
	void Update () 
	{
	
	}


	void OnGUI() 
	{

		GUI.skin = charCreationSkin;

		GUI.matrix = Matrix4x4.TRS( Vector3.zero, Quaternion.identity, new Vector3( Screen.width / 1980.0f, Screen.height / 1080.0f, 1.0f ) );



		if (GUI.Button(new Rect (1879 , 0, 100, 50), "Start Game"))
		{
			Application.LoadLevel(2);
			
		}


		lanistaName = GUI.TextField (new Rect ( 850,  0, 250, 25), lanistaName, 25, myGUIStyle);
		lanistaAge = GUI.TextField (new Rect (950, 50, 50, 25),  lanistaAge, 3, myGUIStyle);

		if (GUI.Button (new Rect (550, 300, 100, 50),"+"))
		{
			//If this button is pressed it adds 1 point to Charismapoints from lanista points and takes 1 away from lanistapoints.
			//for(int i = 0; i < charismaPoints; i++ )
			//{

			//}
		}

		if (GUI.Button (new Rect (675, 300, 100, 50),"-")) 
		{
			
		}

		if (GUI.Button (new Rect (550, 360, 100, 50),"+")) 
		{

		}

		if (GUI.Button (new Rect (550, 420, 100, 50),"+")) 
		{
			
		}

		GUI.Label(new Rect (275, 300, 200, 50), "Charisma",  myGUIStyle);
		GUI.Label(new Rect (485, 300, 50, 50), charismaPoints.ToString(),  myGUIStyle);





	}



}

I want to be able to press the “+” button and add a 1 to the GUI.Label charismaPoints.ToString() from my lanistaPoints (10), While also subtracting from lanistaPoints.

Example “+” pressed 1 time, charismaPoints is now 16 and LanistaPoints is now 9.

I know I have yet to make a GUI.Label for the lanistaPoints.

Any link or a tip would be helpfull. I think I am on the right path with the forloop but unsure of proper format.

Thanks In advance.

just do this:

void OnGUI() 
    {

       ...

 
       if (GUI.Button (new Rect (550, 300, 100, 50),"+"))
       {
            if(lanistaPoints >=1)
            {
                lanistaPoints -=1f;
                charismaPoints+=1f;
            }
       }

       ...

    }

i hope i helped :slight_smile:

and by the way if those points stay integers its better use int than float

Just put that in the “+” code :

charismaPoints += 1f;
lanistaPoints  -= 1f;