Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by KnightRiderGuy · Dec 22, 2015 at 09:04 AM · uigameobjectchildrendontdestroyonloadchild-to-gameobject

Game Object Looses Children When Return to Scene

I have a game object with the Do Not Destroy on load but when I return to my main scene it looses some of it's children like the UI Slider, how do I fix that?

Inspector Screen Capture showing Children missing

screen-shot-2015-12-17-at-90150-pm.png (44.0 kB)
Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KnightRiderGuy · Dec 22, 2015 at 02:52 PM 0
Share

Bump. I still do not know why my prefab looses some of it's child objects when I return to it's original scene? And yes it does have a "DoNoDestroy" on it.

avatar image wibble82 · Dec 22, 2015 at 03:30 PM 0
Share

when you say 'children' do you mean children of the 'init' object, or just 'objects that init references?'

could you post a screen shot of your hierarchy before and after it breaks, ins$$anonymous$$d of just after?

avatar image KnightRiderGuy wibble82 · Dec 22, 2015 at 04:54 PM 0
Share

I would say objects it references like the UI slider is on a panel on a canvas but it seems to loose connection to that when I change scenes and then return the slider no longer works?

avatar image wibble82 KnightRiderGuy · Dec 22, 2015 at 05:02 PM 0
Share

Well if the other objects are not also marked as 'do not destroy' then they will certainly be destroyed (even if you later recreate them). Could that be what is happening?

Do not destroy guaruntees an object and all its descendants will not be destroyed, but does nothing to protect objects it references.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Firedan1176 · Dec 22, 2015 at 07:57 PM

Those are serialized properties, and those are not saved during scene changes when in Play Mode. DontDestroyOnLoad() is intended for when you switch scenes, to keep those GameObjects in the scene.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KnightRiderGuy · Dec 22, 2015 at 08:07 PM 0
Share

So how would I fix my problem? What would I need to do in order to have my UI slider update when I return to my main scene. No one seems to explain properly how to do this.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Change gameObjects parent at runtime 3 Answers

How do I carry over ui text to the next by obtaining the gameobject children 0 Answers

Grid Layout Group leaking outside canvas. 1 Answer

using DrawMesh to draw all sub meshes and materials for a game object and children 1 Answer

How to run a function in a GO that have DontDestroyOnLoad 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges