Hi all,
Ok, I have some ‘empty’ objects I wish to keep like a camera_pivot and also the directional light.
These objects have no script attached so I can’t set don’t destroy on load.
Is the simple solution to attach a script to each of these that simply in start() sets don’t destroy on load?
Is this the correct approach I guess I’m asking? 
Thanks
You can mark GameObjects as DontDestroyOnLoad(); So whoever creates it can mark it. Otherwise you can always use lazy initialization:
static GameObject persistentGameObject = null;
public static GameObject PersistentGameObject
{
get
{
return persistentGameObject ?? (persistentGameObject = new GameObject("PersistentGameObject));
}
}
This will either return the stored GameObject or return a new instance of the Object if it’s been destroyed allowing the MonoBehaviours and Child GameObjects to be cleaned up on a per scene basis.
Hey Ntero,
Sorry you lost me 
I get the just the script returns either the current object or a new one.
But where does this script go?, what’s it attached to??
Thanks
BTW, “light” doesn’t seem to remain persistent even with a script attached - I guess it’s no big problem though 
You could place it on some sort of Manager class or Static class of utilities.
Where it goes is not really all that relevant so long as it’s sensible in your design.
The important part is that whomever wants to access that Persistent object doesn’t use GameObject.Find() but accesses it using that Property. Otherwise it’s totally up to you where it’s placed.
Also I just edited it, the variable should be static and not public.
It’s important to note it’s not REALLY persistent, you will need to re-add all your functionality each scene, but the GameObject will always be accessible regardless of if it was destroyed. Otherwise just mark DontDestroyOnLoad() with the GameObject if you want it’s MonoBehaviours/Child GameObjects to persist.
Thanks. Though I am unsure what to do with a skinned mesh. Does every node need a keep me alive script attached?
Cheers
Reading the Docs, it states that if you call DontDestroyOnLoad on one object it’s entire Hierarchy will be preserved. So just mark the Root GameObject and you’ll be fine.
Hmmm, now I tried this. Setting my ‘character’ root with my don’t kill script and my camera,light etc.
It still moans when going to another scene that a child wasn’t killed though it’s parent was.
Cheers though 
Still got issues with this.
I want my main character to be persistent between scenes but gets duplicated going back and forth between them (as expected I guess). Don’t want to kill the object and recreate another version.
Am confused at a solution; and can see from searching I’m not the only one :-))
Cheers
OK, 1 scene that gets inited once with all the persistent stuff in seems to do the trick!
Looked at singletons and all kinds of other stuff - headache man, headache …
Simple solution BEST! ;'-)
Cheers
Sigh!, spoke too soon!. Runs fine in the editor crashes on the iPhone (or rather just hangs ; no idea why) :-((((((((((((