How can I implement this feature?

I have a scriptable object called Augment Data that contains a single float. Each instance of Augment Data will have a different float. I have a class “Snail” that contains roughly 20 different floats and a list of Augment Data. Each Augment Data is intended to only be added to 1 specific float in Snail.
For example, an instance of Augment Data called HealthMultiplier with a float value of 0.5f is added to the list in Snail. How can HealthMultiplier be applied to only the healthCap property in Snail?

It sounds like you need some kind of a data transfer object in the middle (another scriptable object for example). To me, the easiest solution would be to have a scriptable object with the Snail game object directly and just set the snail data on the snail in the scriptable object and instantiate it at runtime. I’m not sure why each float needs to be stored in this Augment Data object, but assuming that it is some design pattern that you must adhere to, you could make an additional scriptable object with your Snail schema with all the Augment Data fields named accordingly.


public class AugmentData : ScriptableObject
{
    public float value;
}

public class SnailSo : ScriptableObject
{
    public AugmentData health;
    public AugmentData speed;
    //And so on
}

public class Snail : MonoBehaviour
{
    [SerializeField]
    private SnailSo snailSo;

    private float health;
    private float speed;

    private void Awake()
    {
        Initialize();
    }

    private void Initialize()
    {
         health = snailSo.health.value;
         speed = snailSo.speed.value;
    }
}

I would prefer some Snail factory in the middle so initialization code is not in the snail class (you wouldn’t need the initialization code if you just had a Scriptable object with a snail game object though). Anyhow, hope that helps

If I undestand correctly, the problem here is:

  • How to evaluate in which float in the Snail G.O. a Augment Data asset will be added/multiplied.

Is that right?

I would probably have a method inside each Augment Data that finds the Snail somehow, even an event if you don’t want tight coupling, and calls a method in Snail.

public AugmentDate : ScriptableObject
{
   private float foo = 10f;

private void AddFoo()
{
   Snail.AddFoo(foo);
}

public class snail
{
    private TheFoo;

    public void AddFoo(float foo)
    {
        TheFoo += foo;
    }


}