Pin Count text is not updating

Hi all,

So everything was working fine until I got past this lecture, and I noticed that my PinCount display text was no longer turning from red to green once the pins had settled. I messed around with it a bit and tried to change the color and text of the object in various places in my PinSetter script and found that for the most part it wasn’t responding to anything (the pin count would still turn red when the ball entered the PinSetter, and would still track pins standing, and would take on any changes I added to the Update method, but changes elsewhere wouldn’t take).

After trying a few things I reverted to an old version and re-added the LaneBox, and re-wired the ActionMaster (I call it ScoreMaster). Existing things didn’t break this time around, but I still found that the PinSetter will not respond to all of my updates. As an example, I have my CountStanding method pasted below. In the last if block the method changes the PinCount color to white and changes the text to “10”. The color change works, but the text change does not. The pinCount display stays at whatever it was before I tried to change it to 10. The two Debug statements indicate that the text is indeed changing to 10, but the inspector and the actual display say otherwise.

I am using Unity 2017.

Any ideas on what might be going wrong?

int CountStanding() {
	int standing = 0;
	foreach (Pin pin in GameObject.FindObjectsOfType<Pin>()) {
		if (pin.IsStanding()) {
			standing++;
		}
	}
	if(standing != lastStandingCount) {
		lastChangeTime = Time.time;
		lastStandingCount = standing;
	} else if((Time.time - lastChangeTime) > settleThreshold) {
		PinsHaveSettled();
		lastStandingCount = -1;
		int pinFall = lastSettled - standing;
		lastSettled = standing;
		ScoreMaster.Action response = sm.Bowl(pinFall);
		if (response == ScoreMaster.Action.Tidy) {
			animator.SetTrigger("tidyTrigger");
		} else if (response == ScoreMaster.Action.Reset || response == ScoreMaster.Action.EndTurn || response == ScoreMaster.Action.EndGame) {
			animator.SetTrigger("resetTrigger");
			lastSettled = 10;
			pinCount.color = Color.white;
			Debug.Log(pinCount.text);
			pinCount.text = "10";
			Debug.Log(pinCount.text);
		}
	}
	return standing;
}

Privacy & Terms