- Home /
Reference to another script not working, not throwing any errors
This was working and all of a sudden this stop working, In the inspector everything is assigned. i have no idea what has gone wrong here any help is appreciated. Thanks ..
Here is the code. public Ball ball;
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision)
{
if (collision.CompareTag("Player"))
{
ball.currentHealth = 0;
print("Helps");
}
}
}
yes Ball has this currentHealth float in its script called Call.cs. and there is no null reference error.
-did you already set your player to it's tag ? -try checking if the ball actually entered by using collider.gameobject.name
Btw what you mean by it's not working is that the ball current health didn't update or ?
Your answer
Follow this Question
Related Questions
Collision being ignored 3 Answers
LockCursor script not working as intended 3 Answers
How do I get my camera shaker to trigger on collisions? 0 Answers
Weird result using Spherecast 1 Answer
Mesh deformation of a high poly 3D model causes FPS dropping 0 Answers