I created this script, that should so how many objects you still have to collect, so to show this i used a GUI Label. But i know at the end i can write a string, but i want to display a variable instead of a static string.. anyone knows how to help?
Here's the current script:
var itemTracker;
itemTracker = GameObject.FindWithTag("GameController").GetComponent(GameStats);
var imagePositionLeft = 10;
var imagePositionTopFeather = 10;
var imagePositionTopWood = 30;
var imagePositionTopWax = 50;
var imageWidth = 40;
var imageHeight = 40;
var featherImage : Texture ;
var woodImage : Texture ;
var waxImage : Texture ;
var feathersLeft = 0;
var woodLeft = 0;
var waxLeft = 0;
var textPositionLeft = 30;
var textWidth = 200;
var textHeight = 30;
feathersLeft = itemTracker.feathers;
woodLeft = itemTracker.wood;
waxLeft = itemTracker.wax;
function OnGUI()
{
//Images
GUI.Label (Rect (imagePositionLeft, imagePositionTopFeather, imageWidth, imageHeight), featherImage);
GUI.Label (Rect (imagePositionLeft, imagePositionTopWood, imageWidth, imageHeight), woodImage);
GUI.Label (Rect (imagePositionLeft, imagePositionTopWax, imageWidth, imageHeight), waxImage);
//Text
GUI.Label (Rect (textPositionLeft, imagePositionTopFeather, textWidth, textHeight), feathersLeft);
GUI.Label (Rect (textPositionLeft, imagePositionTopWood, textWidth, textHeight), woodLeft);
GUI.Label (Rect (textPositionLeft, imagePositionTopWax, textWidth, textHeight), waxLeft);
}