Sample that goes over how to import SDF for texture trough code. And how to change its SDFImportSettings
.
This function ensures that sdf is generated for texture.
<aside> 💡 Texture need to be configured to sprite mode, and have sprites defined, function changes only sdf import settings.
</aside>
Select 0_Import SDF : ScriptableObject
Press Fix texture (Ensure that SDF is imported)
See how big-bang.png now has sdf generated inside of it
Before
After
Modify import settings
Press Set SDF Import Settings
See how these import settings gets applied to big-bang.png, and it gets re-imported.
Before
After
Both functions used if pretty simple, just pass persistent texture. And in case of SetImportSettings
also provide sdf import settings.
SetImportSettings
is much more versatile then FixTextures
, while second one is basically a wrapper around first.
Press Validate button
The validation result will be printed in console