Variable does not save in prefab

So I have set up a script and attached it to a rigid body, in the script i have drag and dropped a variable but when i change the whole thing into a prefab and try to instantiate it it doesn’t have that variable within it, any ideas why or how to fix this. I have tried drag and dropping once a prefab and hitting apply and it doesn’t help.

thanks for any advice

By ‘drag and drop a variable within it’ you mean, you drag&drop an object-reference on a slot of a variable, right?
Not sure, but I dimly remember reading about this. I hope I’m not talking complete nonsense here (Half a year no unity and you forget everything oO )…
It makes kind of sense… Prefabs are meant to be able to work all the same in completely different games.
So it can’t have a reference to some other part of a specific game baked into it’s definition without fall-back-strategies.
That would be against its purpose.

However, you can do it differently.
You can reference the object by code and then make sure things are done with the object, only if object is actually there.
That is in accordance with how prefabs are supposed to work…

var myRef : GameObject;
function Start() {
  myRef = gameObject.Find("nameOfTheObject");

function Update() {
  if (myRef != null) { do something with myRef }

Hrmm… there was some rule, whether you should take gameObject.Find or GameObject.Find, but I can’t remember…