• 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 cdrandin · Jan 12, 2015 at 10:00 AM · scriptableobject

Scriptable Objects not working after being built

Hiya guys.

So, main concern in the title. I do all of the data manipulation inside the Unity Editor and things work nicely. However, once I build the project all of the information no longer saves.

I check the contents of the built file I don't see any indication of the .asset files that is usually created for ScriptableObjects.

I have the .asset files in the file hierarchy /Assets/Resources/example1.asset

Could anyone provide some insight as to why this may be happening?

Comment
Add comment · Show 3
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 Mmmpies · Jan 12, 2015 at 10:49 AM 0
Share

How are you storing the items in the hierarchy?

For example I create an empty gameObject and rename to whatever is suitable like Alchemy$$anonymous$$anager or Spell$$anonymous$$anager that has a script on it with a list in it.

When the game starts I create a new list for the player based on whats in that list.

I can post the code screen shots if you think that'll help.

avatar image Mmmpies · Jan 13, 2015 at 07:03 PM 0
Share

Incidentally this worried me as I've been using scriptable objects for lots of this, spells, alchemy all sorts but hadn't tried a build in months, certainly not since I started using them.

Anyway I tried a build which took ages as it complained about some networking issue but now I've got that solved, thankfully the scriptable objects I setup are still there when I put the apk on my phone. The spell menu still has all my spells.

Don't know if that helps you any but as I was doing it anyway I thought I'd report back.

avatar image cdrandin · Jan 14, 2015 at 03:02 AM 0
Share

Thanks for the reply. I actually have a better understand of scriptable objects and it isn't what I wanted. So, I just serialized the data into Playerprefs so i can access at runtime and with ease.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Jan 12, 2015 at 10:58 AM

If i understand your question right, your problem is that you want to save / serialize a ScriptableObject at runtime in a build? That's not possible at all for several reasons:

  • Only the Unity editor can actually serialize anything. Unity's serializer isn't available at runtime. A build can only read the packed assets.

  • When you create a build of your project all assets are packed into packages which can't be modified at all.

Of course you can change a loaded object in memory, but there's no way to re-serialize it, repack, recompress and save the game file packages itself.

You have to use your own serialization system at runtime. The UnitySerializer is one way of serialize something at runtime in a custom format that can later be re-loaded.

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 cdrandin · Jan 12, 2015 at 06:39 PM 0
Share

Thank you. I did not know that.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

26 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

Related Questions

Wrong serialization when using ScriptableObject + [System.Serializable] + inheritance 2 Answers

Is there a way to drag a Subclass onto a Field of the Super Type? 1 Answer

Custom editor window for properties with object fields; how do you save? 0 Answers

How to access a variable in ScriptableObject from another script? 0 Answers

MonoBehavior, ScriptableObject and Object memory usage & performance 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