I have 3 Objects Capsule 1, Capsule 2 and Capsule 3. Every Capsule has a script on it for health/damage. It also contains an int for hits and points. Hits should be increased by one for every bullet that hits the target. Points if it gets destroyed (After 3 hits). These ints for points and hits should be displayed as a TextMesh. But how can I add 3 different ints to an Textmesh? Tried this code, but middle and right doesn't exist in context.
meshPoints.text = "Points: " + (points_right + points_middle + points_left) + "\nHits: " + hits_right;
How is that possible?
Using one script "health" on all of the objects doesn't work as well because after an object gets destroyed the ints become resetted...