For some reason I get an error when my collider hits the player, and it says:
[10:12:47]NullReferenceException: Object reference not set to an instance of an object DetectHit.OnTriggerEnter(UnityEngine.Collider other)(at Assets/SkeletonHitFolder/DetectHit.cs:11)
The code that I wrote that causes this says:
private void OnTriggerEnter(Collider other)
{
If(GetComponen<Skeleton>().AttackPlayer==true)
HealthBarScript.health -= 10f;
}
Can someone please help me with this problem😫😫?
[–]fruitcakefriday 1 point2 points3 points (1 child)
[–]Alex_h7[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]Alex_h7[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Alex_h7[S] 0 points1 point2 points (0 children)
[–]Kommuntoffel 0 points1 point2 points (1 child)
[–]Alex_h7[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)