Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 kamil.slawicki · Dec 07, 2012 at 02:13 PM · prefabassetdatabaseassetserver

Asset Server does not pick up on changes made to prefabs.

Hi there. I have a fallowing problem. I have a prefab in the project, talking about a prefab asset not a prefab instance. This prefab is just a Game Object with a script attached to it. I grab a reference to the script by using AssetDatabase.LoadAssetAtPath() and GetComponent<>() after I get the asset. That does return the appropriate reference. Now when I change values of some fields with scripting the Asset Server does not pick up on the changes at all. I found a work around by reverting the instance of the prefab in the scene and the applying it again. That forces the Asset Server to pick up on changes made. Now, the question is, am I missing a step with scripting that would refresh the changes in some way. I have tried both AssetDatabase.SaveAssets() and AssetDatabase.Refresh(ImportAssetOptions.Default). None of them do the job for me. If anyone has an answer to it, please get back to me.

Comment
Add comment · Show 2
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 skalev · Dec 07, 2012 at 04:40 PM 0
Share

I use AssetDatabase.Refresh(); all the time when I create new assets, and they are picked up. However, I do just save them to disk using the system and not unity.

avatar image kamil.slawicki · Dec 07, 2012 at 04:44 PM 0
Share

Aye, it is a slightly different case. See if I edit my prefab in the project window, the Asset Server has no problem at all with picking up changes. I think that Unity must mark the asset in some way so the Asset Server knows that it has changed.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by skalev · Dec 07, 2012 at 06:43 PM

You could try SetDirty() that will cause re-serialization on refresh.

http://docs.unity3d.com/Documentation/ScriptReference/EditorUtility.SetDirty.html

after that you might (not sure) have to call Refresh()

Comment
Add comment · Show 3 · 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 kamil.slawicki · Jan 15, 2013 at 10:48 AM 0
Share

It did not work. I have tried that already.

avatar image Daeval · Jun 12, 2014 at 08:08 PM 0
Share

For the record, it's over a year later, but this worked for me. I used a Resources.LoadAll<>() and made changes to the returned components, but they weren't being picked up by the asset server until I added the SetDirty().

avatar image Diet-Chugg · Dec 11, 2015 at 05:51 PM 0
Share

Not working for me either...

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

11 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

Related Questions

How to check if an object is asset in build runtime (Not in Editor) ? 4 Answers

Get prefab's path in file system 2 Answers

List all prefabs in project with a specific name 1 Answer

Can anyone help with creating Prefabs for procedural meshes 1 Answer

Getting Prefab Icon from AssetDatabase 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