Hello i have error CS1061 and CS0246, please help.

Hi I am trying to make enemy AI script and i am getting these two errors idk why.
I have game object named as Player in my scene and it is defined in script so how i can solve that out, please help ;p


public void Die() {
   //"GameObject", should be "gameObject". Capitalization matters.
   Destroy(this.GameObject);

   //The type "player" doesn't exist. Do you have a script called "Player", perhaps? Again, capitalization matters.
   player.GetComponent<player>().points += pointsToGive;
}

ok i changed that capitalization, and i dont have any script or nothing else called player.

You didn’t need to change “GameObject” on line 12, that one was correct.
“GameObject” is the type; “gameObject” is the name of the variable.
When you’re declaring a variable, you specify the type. When you’re referencing the variable, you use its name.

If you don’t have a script called “Player” or something similar, then I’m not sure what component you’re trying to get here:

player.GetComponent<player>().points += pointsToGive;

What other script do you have that has a “points” field? That would be the one you want to use between the <> symbols.

Ok i have solution: in unity inspector i didnt have player on “Tag” player, so script could not find player.
thank you for help :stuck_out_tongue_winking_eye: