Hello,
have a batch script (static function) that I use to build my targets using my continuous integration environment.
Before Unity v. 4.2.0 I had no problems in modifying assets before calling BuildPipeline.BuildPlayer( … ), but now I have some persistence issues.
I use my script to “cleanup” my dependency tree. Basically I go through some objects that retains texture references and I nullify all those object pointers to make Unity skip them when building my scene, I want them to not be embedded into my application.
basically I do:
CleanUpTextures()
BuildPipeline.BuildPlayer( scenes, targetDir, buildTarget, buildOptions );
DoOtherStuff()
Here’s the problem:
- I nullify the references in CleanUpTextures and Debug.Log the output to assure this
- I perform the build but I see that all the textures are included into the build (I see them under “Used Assets, sorted by uncompressed size:” into build log)
- I print again the modifications issued in CleanUpTextures() and I see that are still valid (references are NULL)
the very same script was working in v 4.1.x
I’ve been trying with AssetDatabase.SaveAssets(), AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate), AssetDatabase.StartAssetEditing() / AssetDatabase.StopAssetEditing(), EditorUtility.SetDirty( myObjectWithTextureReference ) after modifications, but no luck
please help me, or just give me an hint
thank you
NOTE:
Please don’t ask if my textures are referenced somewhere else into my dependency tree, they are not, I can nullify my target references manually and the build will not include them.