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
1
Question by ThirdPartyNinjas · Dec 03, 2013 at 08:06 AM · importatlaspostprocesstextureimporter

How can I apply settings for a TextureImporter during post process?

I've written an importer for TexturePacker atlases for Unity 4.3 sprites. I've managed to nearly get it to where I want it, but I'm running into an issue. Whenever I change the texture/atlas and hop back to Unity, it will reimport the data, and call my OnPostprocessAllAssets.

Everything seems to go smoothly, but the sprites don't show up correctly immediately. If I change any of the importer settings, then change them back and hit apply, the sprites are perfect. (I can also go into the sprite editor, change something, hit undo, then apply.)

Clearly I'm missing something in the script that's happens when I hit apply. Any ideas? Can I force that apply myself in code? I'm hoping this is something easy I've overlooked in the documentation.

The source code for the importer is here.

In case this isn't clear enough, I've recorded a video demonstrating the problem.

Update: It looks like the problem is solved. As GameVortex answered below, I needed to call OnPreprocessTexture, rather than OnPostprocessAllAssets. The updated code is here.

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

Answer by GameVortex · Dec 03, 2013 at 10:46 AM

I believe your problem might come from the fact that you are using the OnPostprocessAllAssets function which gets called after the assets have been imported and therefore the modifications to the importer will not take effect until you hit apply.

I do not know how to get it to force an apply through code, but maybe you could use: OnPreprocessTexture instead? It gets called just before the asset gets imported so you can change the settings and they will be applied. This will happen to all textures though so remember to check for the correct one.

Reference to OnPreprocessTexture

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 ThirdPartyNinjas · Dec 03, 2013 at 01:12 PM 0
Share

I think that's it. I switched over and it appears to work perfectly. Thanks!

avatar image GameVortex · Dec 03, 2013 at 01:19 PM 0
Share

No problem. Glad it worked. =)

avatar image abeldantas · Jun 04, 2018 at 06:50 AM 0
Share

I confirm that using OnPreprocessTexture works - remember to remove the arguments if you were using OnPostProcessTexture

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

18 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

Related Questions

Custom texture importer 1 Answer

TextureImporter and AssetDatabase.ImportAsset 0 Answers

How do I change the Mip Bias of a Sprite Atlas? 1 Answer

Override texture import path 0 Answers

How do you change an asset's import settings at creation? 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