Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
  • Help Room /
avatar image
0
Question by triangle4studios · Jul 23, 2021 at 03:39 AM · nullreferenceexceptionscene-loadingresetbugs

Game Object adds itself back after scene reload?

Here is the base Code. Literally as simple as it gets.

 namespace CompanyName
 {
     namespace Spawning
     {
         public class Spawner
         {
             public SpawnCluster [] cluster;
 
             void OnEnable()
             {
                 Debug.Log(cluster.Length);
             }
         }
     }
 }
 [System.Serializable]
 public class SpawnCluster
 {   
     public string name;
     public int count;
     public int max;
     public Vector3 bounds;
     public Vector3 center;
 }


This is part of a massive spawner, but ended up stripping EVERYTHING out of it until this was the only code left, that still allowed the issue to be reproducible.


Important Notes

  • The spawner is never modified or referenced externally.

  • I have no custom editors of any type in this game.

  • The spawner is in a custom name space, as i have another identically named spawner in a different namespace. However, I removed it from the namespace and the problem persists.

  • I have also tried remove the parent gameObject, closing unity and restarting and running the game again. It adds itself back after the scene reloads.

  • if I removing the game object and run the game, the object adds itself back (LIKE WTF?)

  • The Array has content when i first start

  • The array loses its content when the scene is reloaded.

  • a new script with the exact same content but a different name does not have the same issue.

  • I have tried the usual suspects... reloading and rebooting.

It is like there is a snapshot of my scene somewhere and its locked.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by triangle4studios · Jul 23, 2021 at 04:34 AM

Somehow, unity created a copy of my Scenes folder inside a random folder. Perhaps I did it accidentally when dragging lag occurred which unity is notorious for. Regardless, what ended up happening, is the scene created a new copy of itself, when it was missing and so I was not aware this happened.

Simply removing the duplicate scene solved the issue. Most absurd debugging issue I have ever had. But very very happy it has been resolved.

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 rage_co · Jul 23, 2021 at 06:25 AM 0
Share

nice, i guess this can be a potentially annoying issue to debug. Not sure if i could have done anything if i was in your place.

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

173 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do you call a function once 2 Answers

Trouble with SceneMananger.sceneLoaded and passing dictionaries 0 Answers

Scene Reset on HTC Vive Idle? 0 Answers

Unity 5 NullReferenceException after loading new scene. 1 Answer

MissingReferenceException: The object of type 'Script' has been destroyed but you are still trying to access it. 0 Answers


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