I’m learning Unity for a few weeks and I’m totally new in this nice community. My Problem is, I have a falling Figure called “mermaid” and tagged with “fallingDown”. DestroyOnContacts works perfect.
voidOnTriggerEnter2D(Collider2Dother){
Destroy(GameObject.FindWithTag(“fallingDown”));
}
But i want to count how often the player catched the “mermaid”. My script is already counting, but it’s enough to move the player from left so right, instead of “catching” or touching it. Do you have any ideas what’s wrong?
This is the score script:
publicclassScoreScript:MonoBehaviour{
publicTextscoreText;
publicintmermaidValue;
publicboolIsTouching(Collider2Dcollider);
privateintscore;
voidStart(){
score=0;
UpdateScore();
}
voidOnTriggerEnter2D(Collider2Dother){
score+=mermaidValue;
UpdateScore();
}
}
void UpdateScore (){
scoreText.text =“Score:\n”+ score;
}
}