c# - DontDestroyOnLoad is not Working on Scene? -


i need apply dontdestroyonload on scene.is possible?

i need not disturb scene when going in scenes also.here i'm sending mail,when ever clicking send button going authentication in mail server in time scene idle means not responding until come response mail server,so on time show 1 loading bar in scene.this not process.the entire scene hang until came response mail server,so how solve this?

 void  awake() {       dontdestroyonload(this.gameobject); } 

when loading new level, scene, game objects of previous scene destroyed unity.

if want protect game object can use function.

dontdestroyonload(gameobject); 

it important note when say: this.gameobject pointing pretty same thing, happens this points directly script attached gameobject. don't need this part, gameobject do.

ideally protect gameobject inside void awake()

void awake() {    dontdestroyonload(gameobject); } 

the above code prevent unity destroying gameobject unless game closes or @ later point call destroy() on it. means can change scene scene , gameobject survive. however, if make scene creates gameobject protecting may run problems if not have logic implemented prevents protecting second, third, or many of gameobject.

your second question, if understand correctly: want send mail when change scenes, progress bar wont progress while changing scenes, stays there, static.

if case problem in application.loadlevel(scenename); if have free version of unity, need come own creative way of showing progress bar, because application.loadlevel() halt until takes new scene.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -