Search Unity

Trying to have the enemy hit the player but the type or namespace name could not be found.

Discussion in '2D' started by mediocrecreampuff, Oct 19, 2020.

  1. mediocrecreampuff

    mediocrecreampuff

    Joined:
    Jan 6, 2020
    Posts:
    9
    Im tryin to have code where it tests if the enemy hit the Player object and storing it in a variable using(Player player = hitInfo.GetComponent<CharacterController2D>() I did something similar with my bullet object where it tests for an enemy and that works fine(Enemy enemy = hitInfo.GetComponent<Enemy>() The error it gives is type or namespace name could not be found(are you missing a using directive or an assembly reference?). I looked into other people with the same error and didnt see any information that could help me? Does anybody know how to fix this.
     
    Last edited: Oct 19, 2020
  2. raarc

    raarc

    Joined:
    Jun 15, 2020
    Posts:
    535
    if you read the whole error it tells you the problem