Objects
Objects are a way to store a list of essential and universally used objects that can be easily fetched from any script.

To store a object you must first create the Objects scriptable object. First, you must create a Resources folder. Inside the folder, you can now right-click and select Create/Essentials/Objects/Objects.
If you are creating your own Objects like above, you must remove the Objects in the Objects/Demo/Resources/Objects or you can just use the same one as the demo.

There must always be exactly one Objects object in the project.
To add a mapping to the Objects object; you select the Objects and add a new entry under the Mappings property. Here you can set a Reference string that should be used when querying the object.

You can also add multiple objects per Reference that each has a weighted value to weighted randomize (higher weight = higher chance to be selected) what object is returned. This can be done in the Weighted Mappings property in the same way as the normal Mappings.
To then fetch the object in a script you do the following:
public class TestFetcher : MonoBehaviour
{
private void Start()
{
GameObject ball = Objects.Get("ball"); // fetches the object from the mapping
Instantiate(ball, transform.position, Quaternion.identity); // spawns it
}
}Last updated