Home Creators Posts Import Register Favorites Logout
haven't archived this post yet. have a subscription? use the importer!

Content

Hey!

In  my previous Inventory system tutorial we have used ScriptableObject (SO) to store data about items in our game. Since it had the sprite of the item we had to place items on the map with a red tag "Item" and when we pressed PLAY the sprite was modified to represent this item.


Unity allows us to attach our own code to the serialization process using ISerializationCallbackReceiver - long story short we can automatically update the Sprite of our sprite renderer in the editor to make our level design easier :)


I hope that you will enjoy this tutorial :) 

Files

Previews only

How to use ISerializationCallbackReceiver in Unity

In this video we will automatically swap the sprite of a Sprite Renderer for an image from a Scriptable Data Object that we assign to the Item script in order to have a more data driven logic in our game. Learn to write more maintainable code using Design patterns by making a 2d platformer game: https://courses.sunnyvalleystudio.com/ Join the discord: https://discord.gg/RQEtYHz You can support me through Patreon: https://www.patreon.com/sunnyvalleystudio 00:00 Introduction 00:58 Script Serialization 01:16 ISerializationCallbackReceiver 02:57 Using OnBeforeSerialize 03:28 Testing the result

Comments

No comments found for this post.