Changing a script inside a prefab

I’m working off a solution I found here: Changing Prefab setting through scripting (C#) - Questions & Answers - Unity Discussions

I have a prefab which has a script, I am trying to change the public values of that script. I am trying to access the script using the GetComponent function, but it just keeps yelling at me that object reference is not set to an instance of an object and now I am scared ;_;

Just to be clear, I want to change the script inside the prefab itself, not an instantiated object of the prefab.

Here’s the script: http://hastebin.com/itazovapuy.py

Hello Mako,

So here, it looks like you’re trying to grab a component from an object:

EnemyHealth eh = prefabs[0].GetComponent();

And if you’e getting a null object reference, it means this ^ isn’t getting anything. A better way would be to declare a global variable for the script, like this:

private NameOfScriptYouAreTryingToEdit
variableName;

Then you call that in the script like this:

variableName.EnemyHealth.