Get collision element

dears

i’m building my first iphone game, all think are going fine, but i faced a little problems here.
i want to get name of element with i have made a collision with it
i want to make a score table and i dont know any idear about it so can i have a start point??
my last question is how to save score at the phone ???
thx and regards

any details ?

Is the collision happening with a CharacterController or a rigidbody object?

Do you want to know how to show the highscores on screen or how to store the scores? Do you need to store the scores to a shared database or just to the device?

hello andeeee
the collision is happening with rigidbody object
i want to know to how to store the highscores and store it on the device

thx for your reply

In the script on the rigidbody object, you can add an OnCollisionEnter to get the name of the object that was hit:-

function OnCollisionEnter(coll: Collision) {
  print(coll.transform.name);
}

The PlayerPrefs class provides a good way to store highscores and other data persistently on the device.

thank you MR andeeee i’ll try you ideas :slight_smile: