My approach would have been to cache the Person Transform or GameObject in Finger.
private var person : Transform;
function Start () {}
person = transform.parent.parent.parent;
}
Another way to get the person would be to use GameObject.Find() like this:
person = GameObject.Find("/Person");
But this assumes you have the Person object in the root of your scene since I put a “/” before the “Person” and this is just to make the find faster, otherwise it will search through your whole hierarchy of objects. This will of course limit you to only have one Person object in your scene.
And just as a tips when developing for iPhone and getting components attached to objects through code witch i guess you want to do to apply damage to Person in a script, you should get the component like this:
GetComponent.<ScriptName>();
Another even simple way to do things suggested by “syclamoth” is: