Pokemon in Unity: Using Scriptable Objects

Now that we have have Scriptable Objects and have made a few assets with them, How do we use them? As stated previously, Scriptable Objects and their assets can’t be used directly in a scene, so what are they used for? They are smart data containers that can have some basic program logic which allows use to use them a bit like abstract classes, but a bit in reverse.

In this example, I have set up a custom class for the individual pokemon that the play may encounter or catch. We can store a reference to the pokemon base species asset and access it to determine the pokemon’s base abilities.

Here is the constructor method for the Pokemon Class that I am using. When we create the new pokemon, we also assign the Pokemon Base asset. We can then use the values in the asset to set the pokemon’s base stats. As one of the final steps, after all the stats are assigned, we give the pokemon it’s first level. This will allow the pokemon to use the base stats and the randomly generated modifiers, such as nature and IVs, to generate the actual stats of this individual pokemon.

As for what happens when a pokemon evolves into a new form/species, It is just a matter of replacing the asset reference and use it to update the base stats.

After all this, it comes down to working with the specifics of pokemon such as moves and the math involved in calculating stat changes.

And with this basic knowledge you should be able to build your own system that uses scriptable objects, be it for races, classes or jobs. You also will create items for an inventory system. Let’s see what you can come up with.




A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Java Primitive Data Types

6 short tips to IMPROVE your naming convention

[Mal Series #23] Malware Loader — Bumblebee

Linux Fun Commands

Retrieving the top N records with ties on Postgres

Spotify API with Python and AWS.

WebApp To Create and Manage Webex User Groups

RL Series - DDPG

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thomas Kesler

Thomas Kesler

A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.

More from Medium

Pokemon in Unity: Basics of Scriptable Objects

Day 111: Introduction to Tilemap in Unity

Pushing Objects in Unity

Introduction to Scriptable Objects in Unity Engine