Why do we do ScoreBoard scoreBoard;

Why do we do a “ScoreBoard scoreBoard;”? And where is the ScoreBoard word come from? Does it take the name of the script?

ScoreBoard is a type, scoreBoard is variable. First you declare type and then name of variable.
For example : int scoreNumber; or string name;

1 Like

Just like Rigidbody rb; that we’ve used before.
After this expression, we are calling Rigidbody component with rb. This could be Rigidbody Maison or Rigidbody liquids (lol :smiley: ). As far as I know name is not important. This should be something meaning for you or maybe your teammates. After typing rb. we can reach what Rigidbody is providing us.

With ScoreBoard script (= class, component), we are calling it in enemy script with scoreBoard. And we are using what we provide before. In this case public void scoreIncreaser method.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms