|
I am a beginner in coding but I see the necessity for accessing the AssetPostprocessor. Apart from the official Documentation Here I found this very good example for automatically creating collision meshes, in c# (hmmm) Here I found examples like that very helpful to understand how things work. Are there any other nice examples around? Thanks
(comments are locked)
|
|
What you already have should be more than enough to get you started. Here's another very simple example which automatically attaches a script to any object with "enemy" in the name:
You can use this system of detecting keywords in the model's name for a variety of very useful gameobject modifications during the import process - typically I use it for:
You can also do similar processing based on artist-assigned model properties, using the incredibly large function, "AssetPostprocessor.OnPostprocessGameObjectWithUserProperties". There are also other AssetPostprocessor functions, such as OnPostprocessAllAssets, which you can use for different tasks, the most useful I find being to automatically match up sets of related textures (such as bump map textures, reflection textures, lightmap textures) according to a naming convention, and create and assign the appropriate Materials. Eg, if you had a base material with a texture called "*Road_Diffuse.png*", you could have the asset post processor automatically scan for "*Road_Bumpmap.jpg*" and "*Road_Lightmap.jpg*", and automatically create and assign a Material which uses the Lightmapped Bumped Specular shader, with all the textures already assigned! (I will add examples of this to this answer when I have time - don't have time right now!) Here's another example to apply settings to audio files:
These kinds of automatic processing of art assets are invaluable when you have separate artists producing scenes with many elements which would otherwise need sorting out in Unity by hand after importing. You can then just give your artists the naming conventions to use. ACE!!! Thanks, yep yep .. by name and WithUserProperties seems a really good way to go ! Thanks again.
Apr 08 at 05:29 PM
alexnode
"using the incredibly large function, AssetPostprocessor.OnPostprocessGameObjectWithUserProperties". You made me roll over and laugh and then some. That is a beast! The king of codes!
Jan 12 at 10:06 PM
Statement ♦♦
(comments are locked)
|
|
hi duck :) thanks for the answer, I got quite started too in Asset scripting. too bad i'm still unfamiliar with strings handling, so that texture postprocessor and lightmap / normalmap batch picker, would be a very good tip for me too :) thanks again, indeed :)
(comments are locked)
|
Unity Answers has moved to a new system, and some users may have trouble logging in.