- Home /
AssetPostprocessor scripts order
I have 2 script that extend from AssetPostprocessor and uses OnPostprocessAllAssets.
My problem is that the first script has the main code and the second is a module, so I don't want to join this scripts together.
The second one relies in a functionality that has to be done on the first script first.
How can I get that?
I have seen this, but I don't know if it's what I think it is. It doesn't have many documentation.
http://docs.unity3d.com/Documentation/ScriptReference/AssetPostprocessor.GetPostprocessOrder.html
Thanks!!
Answer by Paulius-Liekis · Oct 15, 2012 at 01:43 PM
return 1 GetPostprocessOrder from the script has to be called first. Return 2/10/any-other-number-bigger-than-1 in GetPostprocessOrder of second script.
Answer by faulknermano · Jun 09, 2020 at 03:34 PM
Example:
public class MaterialProcessor : AssetPostprocessor
{
// This AssetPostProcessor will operate at a very late stage so that the attribs it sets (e.g. _Color) won't get overridden
public override int GetPostprocessOrder()
{
return (100);
}
public void OnPreprocessMaterialDescription(MaterialDescription description, Material material, AnimationClip[] materialAnimation)
{
// Set material shader to Standard
var shader = Shader.Find("Standard");
if (shader == null)
return;
material.shader = shader;
}
}
Your answer
Follow this Question
Related Questions
Help with AssetPostProcessor and keyframes? 0 Answers
Metadata not being saved on custom file types 0 Answers
Importing lpc assets 0 Answers
adapting replace prefab example 1 Answer