Having trouble calling a variable from another script

Hey Guys,

In my scene, I have a game object “SystemsManager” which controls all of the UI Texts for my spaceship, called “PlayerShip”.

SystemsManager has a script “SystemsScript”, which calls the variables from PlayerShip’s script (“Ship”)and displays the values with my UI Text objects. I got it working okay, but when I tried to call a variable from a second script attached to my PlayerShip, called “PlayerShipDamage”, it wouldn’t work.

    public class SystemsScript : MonoBehaviour 
    	public Text velocityText;
    	public Text throttleText;
    	public Text headingText;
    	public Text fuelText;
    	public Text playerHealthText;
    	private Ship shipScript;
    	private PlayerShipDamage playerDamage;
    	// Use this for initialization
    	void Start () 
    		GameObject Ship = GameObject.FindWithTag("Player");
    		shipScript = Ship.GetComponent<Ship>();
    		playerDamage = Ship.GetComponent<PlayerShipDamage>();
    		velocityText.text = "Velocity: " + shipScript.currentVelocity.ToString("0.00") + "m/s";
    		throttleText.text = "Throttle: " + shipScript.throttle + "%";
    		headingText.text = "Heading: " + shipScript.heading.ToString("0") + "deg";

            playerHealthText.text = "Player Health: " playerDamage.playerHealth + "%";

It works fine with the variables being called from the script Ship, but when I do the exact same thing with the script PlayerShipDamage, I get the following error:

Assets/Scripts/SystemsScript.cs(33,70): error CS1525: Unexpected symbol `playerDamage’

I’ve examined the code several times, and it should work, but it doesn’t.

Can anyone let me know what I’m doing wrong?


You are missing a +