RaycastForEnemy Error

Hi all,
After the major refactor the attack icon is gone in my game. After playing for a bit, I get this error:

NullReferenceException: Object reference not set to an instance of an object
RPG.CameraUI.CameraRaycaster.RaycastForEnemy (Ray ray) (at Assets/_CameraUI/CameraRaycaster.cs:49)
RPG.CameraUI.CameraRaycaster.PerformRaycasts () (at Assets/_CameraUI/CameraRaycaster.cs:41)
RPG.CameraUI.CameraRaycaster.Update () (at Assets/_CameraUI/CameraRaycaster.cs:33)

I thought it might be a coding issue so I reviewed my code several times. Then, I went into Ben’s repository and copied the code into my game (last ditch effort). Still, no attack icon. I checked to see if the attack icon was selected in the inspector; it’s there. The walk icon works.

Weird thing - I downloaded Ben’s version from the repo and got the same error above. However, Ben’s attack icon worked.

Will post small version of project soon.

Thanks,
Mike

I had to remove all my enemies and then replace them after the refactor. Not really sure why as we didn’t refactor anything that dealt with the enemy. However, it worked and thought I’d share that in case you have the same issue.

1 Like

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

Privacy & Terms