Hi guys !
Ok so basically I have this script :

And as you see I want my var “choisi” too stay while i’m changing scene.
I tried DontDestroyOnLoad() on a Awake() function but it doesn’t word
PS : “choisi” is supposed to be a FBX Model, not a GameObject, maybe that’s the reason why it doesn’t work
Help me guys plz
(sorry for bad english)
Thanks you !

Generally it’s better to post scripts using code tags and not a screenshot of it. Small image, I can barely read it.
Stuff that exist in your scene are gameobjects. So if you have a model in your scene, it’s still a gameobject. (thus the reason you can drag and drop it into the variable). If it doesn’t drag and drop into the variable, it wouldn’t work.
However, I see two issues. First, using GameObject.Find is probably not a good idea. But this isn’t the reason things aren’t working.
I see you are trying to assign a value to choisi in some method (font is tiny so I can’t read the method name)
In awake you want the gameobject not to be destroyed. If no value is assigned to the variable, it will probably throw an error.
However, chances are you dragged something into that variable. But then you are trying to assign a new value to choisi. DontDestroyOnLoad targets a gameobject, not the variable itself. If you assign a new value to the variable, it’s not going to switch the target of DontDestroyOnLoad. In otherwords, if you plan to assign a new value to that variable and want that gameobject to stick around, you have to call DontDestroyOnLoad on the new value of that variable.
Since you call DontDestroyOnLoad in awake, only the gameobject assigned to that variable at that time will be targetted, not anything new assigned to the variable.
Just be warned you don’t do this when you dont want something sticking around as you could have several objects floating through scenes.