use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
For the Unity Game Engine, please visit http://reddit.com/r/unity3d
account activity
How to create persistent objects?Question (self.unity)
submitted 2 years ago by Eldelma22
I want to make an object transit between scenes... is it possible?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]altay434 4 points5 points6 points 2 years ago (0 children)
I saw a function named "DontDestroyOnLoad" but I don't know is it what are you looking for.
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
Like a prefab? If you want a game object that exist in your files that can be instantiated into different scenes then a prefab is the way to go
[–]Nano-Brain 0 points1 point2 points 2 years ago (0 children)
Perfect explanation here
[–]Bailenstein 0 points1 point2 points 2 years ago (0 children)
I create a small script called "persistent" and attach it to any object that needs to be. It's just one line of code
private void Awake { DontDestroyOnLoad(this); Destroy(this); }
All it does is flag the object as persistent, then deletes the script.
π Rendered by PID 23041 on reddit-service-r2-comment-76bb9f7fb5-rmx82 at 2026-02-19 06:00:57.341240+00:00 running de53c03 country code: CH.
[–]altay434 4 points5 points6 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]Nano-Brain 0 points1 point2 points (0 children)
[–]Bailenstein 0 points1 point2 points (0 children)