Hello!

Any help on this topic will be appreciated, as I have been struggling with this error for a little bit and don’t know where to start.

The error im getting shows that there is a null value. This error pops up when my enemy pirate ship is attempting to shoot at the player.

When double clicking on the error, it takes me to the following code snippet:

private void TurnTowardsPlayer()

{

Vector3 direction = playerTransform.position - transform.position;

```
// Calculate the rotation angle in degrees
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
// Create a quaternion rotation using the calculated angle
Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
// Apply the rotation to the object's transform
transform.rotation = Quaternion.Lerp(transform.rotation, rotation, 0.5f);
}
```

hopefully this is enough information to get started, any help is appreciated!