Prefab annoyance, wont save with new script

So I’m trying to make a score counter so that whenever my bullet prefab hits its target, it would access a variable in my other script to increment the score via a public accessor of the score keeping script within the bullet script. However, for whatever reason, I cannot edit the prefab. Dragging it into the hierarchy, modifying it, and trying to put it back into my prefab folder does nothing, even though it is properly modified in the hierarchy. I cannot edit the prefab directly in its prefab folder either, which is very annoying. I’m sure it’s an easy and stupid fix, but I cannot find anything helpful at all online.

Prefab Assets cannot have references to scene objects - they can only keep references of objects/components within a prefab asset.

You need to add a script to your prefab and set references in Awake as an initialization. Something like this:

private ClassWithWariable classWithVariable;

private void Awake()
{
   classWithVariable = FindObjectOfType<ClassWithWariable>();
}