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
2
Question by Byterunner · Mar 29, 2011 at 12:04 AM · editoreditor-scriptingsaveassetsprocessor

Has anyone successfullly used SaveAssetsProcessor?

I can't seem to hook into this: SaveAssetsProcessor. The documentation is severely lacking, as in not even listing a return value.

I have the following code as a start, but can't seem to get anything to happen ever...

 using UnityEngine;
 using UnityEditor;
 using System.Collections;

 public class FileModificationWarning : SaveAssetsProcessor {

     string[] OnWillSaveAssets (string[] paths) {
         Debug.Log("OnWillSaveAssets");
         foreach(string path in paths)
         Debug.Log(path);
         return paths;
     }
 }

I've tried having OnWillSaveAssets be void as well, but no luck and no errors to indicate what could possibly be wrong.

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
9
Best Answer

Answer by Byterunner · Mar 29, 2011 at 12:17 AM

Solved it. The function needs to be static:

 using UnityEngine;
 using UnityEditor;
 using System.Collections;

 public class FileModificationWarning : SaveAssetsProcessor {

     static string[] OnWillSaveAssets (string[] paths) {
         Debug.Log("OnWillSaveAssets");
         foreach(string path in paths)
         Debug.Log(path);
         return paths;
     }
 }
             
Comment
Add comment · Show 7 · 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 Justin Warner · Mar 29, 2011 at 12:22 AM 0
Share

$$anonymous$$ark your answer as an answer! And I believe you get a badge ;). Haha!

avatar image Byterunner · Mar 29, 2011 at 12:31 AM 0
Share

I must wait 47 hours before accepting my own answer!

avatar image Antony-Blackett · Apr 14, 2011 at 12:05 PM 0
Share

Does this actually work? All I can get it to do is run the function but paths is always empty.

avatar image Byterunner · Apr 14, 2011 at 10:06 PM 0
Share

Yes, it does, though not always as you'd expect. I created a prefab out of a cube, saved it and added it to a scene, which I saved. Now when I open the scene and modify the prefab, apply the changes and save scene and it prints out the name of the scene and the prefab. If I modify the properties on a texture importer and apply the changes and save project, it will run the function, but not print the path. I'm not sure how to get that to work, but it's out of the scope of what I need so I didn't pursue it.

avatar image rohitvishwakarma1819 Byterunner · Oct 29, 2018 at 09:59 AM 0
Share

Hey this is exactly happening with me did you find the fix ?

also when the error came unity get stuck and when I switch to different app the error come once always

avatar image liortal · Jun 24, 2014 at 11:59 AM 1
Share

Note that this class is obsolete. Ins$$anonymous$$d use Asset$$anonymous$$odificationProcessor: http://docs.unity3d.com/ScriptReference/Asset$$anonymous$$odificationProcessor.html

Show more comments

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

1 Person is following this question.

avatar image

Related Questions

Editor scripting - How to show the Assets menu as a context menu 1 Answer

Cannot close/unload a scene that is open in editor during playmode (using C# code)? 3 Answers

Stop a MonoBehavior from being addable as a script? 0 Answers

How To Best Match Editor GUI Content Heights 0 Answers

runInBackground in Edit Mode 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