Possible to make editor script to auto set Needle Compression settings?

Do I need to import anything for CompressionSettingsModel ? It didn’t pull in with Import Needle

by user 103054507105067008

It’s in Needle.Engine.GltfExport.asmdef in this namespace Needle.Engine.Gltf.Experimental

Okay got the asmdef in, is there an example of it used anywhere else so I can see where to declare and use it?

by user 103054507105067008

I did the dumb thing and try to copy paste it in to here https://discord.com/channels/717429793926283276/1067869919192039504/1068117713416888350 to set on import

by user 103054507105067008

It’s just these I want to change with Editor script per texture on import v

by user 103054507105067008

I think we misunderstood.

You can:

A) Subclass TextureCompressionSettings, this is a component.
- When its in your scene it will be invoked on export with each texture + slot the texture is used in. If you just add it to the scene by default normal maps for example will get UASTC (instead of ETC1S)
- When you subclass it you can override what compression type you want without modifying any asset.

B) Set the texture settings with NeedleAssetSettingsProvider static methods in your importer

I’ll be doing option B, I will search the scripts for any refs toNeedleAssetSettingsProvider

by user 103054507105067008

bool TrySetTextureSettings(Texture tex, NeedleTextureSettings settings)
bool TryGetTextureSettings(Texture tex, out NeedleTextureSettings settings)
^ you need these two

No refs to it,what does NeedleAssetSettingsProvider belong to?

by user 103054507105067008

Sure its used on export :slightly_smiling_face:

I might crack VS code open to open the whole package cache for Needle to search better without asmdefs in the way

by user 103054507105067008

You can enable creating projects in Unity for registry packages

maybe thats why the vscode search is lacking?

in Unity preferences / external tools (or is that Rider only? might be)

I can recommend Rider :smile:

Slower than vscode but great search, decompile on the fly… lots of cool features :slightly_smiling_face:

Ah that’s done it thanks, yeah I always use Visual Studio Community 2022 with Intellicode at the moment, might try Rider but so far have no reason to change

by user 103054507105067008

I don’t think I can actually get the Texture2D before it has imported here

by user 103054507105067008

Unity - Scripting API: AssetPostprocessor.OnPostprocessTexture(Texture2D)

Nice, can’t find anything using TrySetTextureSettings though so I get no definition for… when using NeedleAssetSettingsProvider.TrySetTextureSettings(tex2d, out var textureSettings

by user 103054507105067008