Problems accessing a function

Okay, so I know people ask this a lot but this is a specific question (I already basically know how to do it)

I’m trying to access a script inside a particular object and call a function in it, I essentially just copied the code from unity script reference that says how to do that.

var ConPlat = GameObject.FindWithTag("AntiCore");

But it keeps saying that on that second line that “object reference not set to an instance of an object”. I know it’s not talking about MissDamage because that’s an int, and there is a script called CollideCounter, and the object that has that script does have a “Core” tag. So I’m confused.

I see two possible places for an error:

  1. You’ve said it had a “Core” tag, but does it have an “AntiCore” tag like your code asks for?

  2. GameObject.FindWithTag returns ONE gameobject, but I believe it’s a random object with that tag. Maybe it’s not the gameobject with the “AntiCore” tag that you’re looking for–and maybe the object that it’s finding doesn’t have the CollideCounter script on it. You know?