I think it's better to formulate the problem via code. I have a BaseClass.
public abstract class BaseUnit {
[System.Serializable]
public class Settings
{
}
}
And some derived classes, for example.
public class Archer : BaseUnit {
public ArcherSettings Settings;
[System.Serializable]
public class ArcherSettings : Settings
{
//CanWalk is a MonoBehaviour and WalkSettings is a Serrializable class
public CanWalk.WalkSettings WalkSettings;
}
}
So as you can see I want to have several unit types with appropriate WalkSettings which will be set from ScriptableObject.
public class ScriptableLevelInstaller : ScriptableObjectInstaller<ScriptableLevelInstaller>
{
public Archer.AracherSettings Aracher;
public Knight.KnightSettings Knight;
//Some more...
}
So the question is how to Inject appropriate settings into appropriate classes with Zenject any help or clarification would be very helpful.
---UPD---
I express myself poorly the first time. What I want is bind CanWalk.WalkSetting to approprirate settings. So I can do
Container.Bind<CanWalk.WalkSettings>().FromInstance(Archer.WalkSettings);
But this is wrong because the last binding will just override walk settings for every class. So What I need is something like
Container.Bind<CanWalk.WalkSettings>().FromInstance(Archer.WalkSettings).WhenInjectInto("CanWalk which is attached to an Archer")
For now I'm just doing this inside Aracher.
GetComponent<CanWalk>().Settings = _settings.WalkSettings;
But maybe there is something in Zenject to solve this.