Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 BigBuckleDeveloper · Jul 25, 2015 at 03:41 PM · unity 5inspectorbuild-errorvisual studioperforce

All inspector fields reverting to default values when built to executable

Howdy,

I've been smacking my head against this issue for two days now, and could really use some help. I have a project that's recently been exhibiting some dismaying behavior: every public field that is assigned to in the inspector (both reference and value types), in all scripts and all scenes, is being set to its default value when the project is built. It can be played from the editor just fine, but building a separate executable results in piles of null references and wrong values in the resulting executable. The problem occurs both for scripts attached to gameobjects in scene, and also some other associations (e.g., the materials being stripped off of models so that they look untextured when instantiated at runtime).

I’ve tried the following: re-assigning the values by hand in the inspector, renaming variables within scripts and re-assigning the values in the inspector, deleting the metadata files for the scripts to force Unity to remake them, deleting the metadata files for whole scenes to force Unity to re-make them, explicitly marking classes with [System.Serializable], deleting the Library folder to force a rebuild of its contents, deleting the Visual Studio solution files to force their rebuild, and duplicating whole scenes and using the copies. The only fix that seems to work is re-establishing the links via code at runtime; not an ideal solution to implement for every public variable in the whole project.

I know that data corruption isn’t too rare in larger Unity projects, but this is a scale and impenetrability beyond any that I’ve seen before. None of the usual fixes appear to be working, so I’m somewhat stumped. As it may be relevant, we're using Perforce as our version control (using P4V as our client, not any Unity perforce plugin) and Visual Studio as our IDE.

Does anyone have any wisdom that they can impart? I have a deadline looming, and this hurts.

Cheers, jonathan

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 BigBuckleDeveloper · Jul 26, 2015 at 07:12 PM

So it's embarrassing, but in case any else has a similar issue, I'll admit that the bug was our fault, and was due to singleton stomping.

We had a custom generic singleton class that we used for a bunch of our manager scripts. The bug was exposed when a script started referencing the singleton before the scene in which we had our configured instance of the class had been loaded, so it created a new (unconfigured) instance. Then, when our configured instance showed up, it happily destroyed itself like a good redundant singleton should. In addition, since many of our manager singletons were on the same object, it murdered a bunch of the other configured instances as well. The carnage was extreme.

Watch your singleton loading, folks!

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

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

2 People are following this question.

avatar image avatar image

Related Questions

Scrollview can't scroll with buttons that have Event Triggers 0 Answers

VS2015 installation error with Unity installer (1603) 0 Answers

[Solved]Autocomplete in Visual Studio Won't Work, Please Help! 5 Answers

Error building scripts: Cached player destination differs from selected player destination. Please disable scripts only build and build again before attempting another scripts only build 0 Answers

Android build error: unrecognized pixel format 264 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