RSODatabase

This is a simple Scriptable Object that stores all the relevant data that could be required. It functions as a mass database to allow quick recall of Scriptable Objects (SO) using a Key (INT) as the reference if known but also allow a search to find the correct Key when it is not known.

public ScriptableObject Get(int key)

This is a simple get based on knowing the Key of the object you are looking for, it will always return it as a scriptable object, so the code calling this data should know what type of and cast it correctly.

public int GetKey(ScriptableObject target)

This searches the database looking for the correct one related to the supplied (SO) and returns the Key (INT), if the (SO) is a RSORoot, it will grab the id stored in that (SO)

public virtual void Add(ScriptableObject data, bool generateKey = true)

General Call that adds a (SO) to the database, this generateKey will force a new key to be generated.

If the (SO) that is being added is an RSORoot, this will also set the Key in the (SO) to speed up search times.

Last updated