Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency between imported asset and Preset asset. #50

Closed
bastienunity opened this issue Dec 18, 2019 · 0 comments
Closed

Dependency between imported asset and Preset asset. #50

bastienunity opened this issue Dec 18, 2019 · 0 comments

Comments

@bastienunity
Copy link

Hey there!
I've found your project on the Preset blog post on Unity's website, glad that people are looking into it and doing some nice custom stuff with it!

I got one comment for you regarding this file: Tools/AssetPresetPreprocessor/AssetPresetPreprocessor.cs
When applying a Preset to an asset, you probably want that asset to be re-imported whenever the Preset used to enforce the settings get changed, and this is possible starting in 2019.3 and using asset database v2.
You have to call context.DependsOnSourceAsset(AssetDatabase.GetAssetPath(preset)) before applying the preset to the importer. This way you get assured of two things:

  • Your asset will not be imported before the Preset is discovered by the asset database (or if it does, it will stop importing at that point and will wait for the Preset asset to be imported first).
  • Your asset will trigger a re-import automatically to use the new Preset setting whenever the Preset asset is changed on disk (when updating your project from a VCS or changing the Preset values and using Save Assets).

We also have a bunch of improvements coming in 2020.1 for presets, including the PresetManager being able to handle folders and any naming convention you want, along with Partial Preset that allows you to exclude properties from the Preset directly in the Preset or its inspector. You may want to have an early look at that as you're a doing a bunch of stuff that may not be necessary anymore after this release.

@Deadcows Deadcows closed this as completed Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants