ScrollWindow AutoUpdating value help :(

Hi, really new to unity and c# here but learning quite a bit from tutorials, ive just got stuck on 1 little bit here and i cant seem to find a proper desription. ive made a scrollview window (included a picture of my results
[34131-scrollable+window.jpg|34131]

and its scrolling through the value instead of waiting for the value to change (basically ive got a health script which works fine when a mob does damage) but i was trying to make a small combat log style window but it doesnt seem to wait for a change in value, i’ve put a line in the wrong place so im hoping someone could just point me in the right direction.

thanks for any help on this (syntax is a killer for me, so difficult to pick up)

using UnityEngine;
using System.Collections;

public class combat_log : MonoBehaviour {
	public Vector2 scrollPosition = Vector2.zero;
	public string longString = System.Convert.ToString(playerhp.curhp);

	void LateUpdate ()	
	{
		ammendlog(0);
	}

	void OnGUI() 
	{
		GUI.Box (new Rect (Screen.width - 798, Screen.height - 125, 352, 123), "");
		GUI.skin.label.alignment = TextAnchor.MiddleLeft;   
		GUILayout.BeginArea (new Rect (Screen.width - 798, Screen.height - 125, 352, 123));
		scrollPosition = GUILayout.BeginScrollView (scrollPosition, GUILayout.Width (350), GUILayout.Height (121));
		scrollPosition.y = Mathf.Infinity;
		GUILayout.Label (longString);
		GUILayout.EndScrollView ();
		GUILayout.EndArea ();
	}

public void ammendlog(float adj) 
	{
	longString += "

" + " Current Health : " + System.Convert.ToString (playerhp.curhp);
}
}

You’re calling ammendLog(0) once per frame.

According to the Manual:

LateUpdate: LateUpdate is called once per frame, after Update has finished. Any calculations that are performed in Update will have completed when LateUpdate begins. A common use for LateUpdate would be a following third-person camera. If you make your character move and turn inside Update, you can perform all camera movement and rotation calculations in LateUpdate. This will ensure that the character has moved completely before the camera tracks its position.

You could try something like:

int prevHP = playerhp.curhp; //Create a new var - Note: I was unsure of type

void LateUpdate ()
{
    if(playerhp.curhp != prevHP) //Keep checking if HP has changed
    {
        ammendlog(0); //if it has ammendlog()
        prevHP = playerhp.curhp;
    }
}