Join Jesse Freeman for an in-depth discussion in this video Saving scriptable objects, part of Unity 5: 2D Emulate Palette Swapping for Sprites.
- So now that we're able to get the path…from the selected asset when we try to create…our new color palette, let's actually look…into how to save the scriptable object itself.…In our Scripts folder, let's create…a new C Sharp script, and we're gonna call this…CustomAssetUtility.…Let's open this up in MonoDevelop.…Since this is gonna be a utility class,…we won't need to extend mono behavior,…and we can delete the Start and Update methods.…Let's also include the UnityEditor name space.…
So now let's create a public static method…that we can use to create our asset.…Here, we'll type out public static.…Our type is going to be a generic,…so we're gonna use T to represent the return value.…We're gonna call our method CreateAsset,…and we're also gonna pass in T…as the generic type, as well.…Then we'll need the path, where to create our file,…so this is going to be a string called path.…And we wanna let the method know…that T represents a scriptable object.…
Now let's close out the method.…Inside of it, we'll need a variable…
Updated
7/11/2016Released
5/19/2015- Importing artwork
- Working with sprites and animations
- Creating scriptable objects
- Sampling colors from sprite textures
- Extending Unity and building a custom inspector
- Creating custom textures
- Optimizing the palettes
- Cleaning up sprites in Photoshop
Share this video
Embed this video
Video: Saving scriptable objects