You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is powerful thing to have implementations private while still be able to assign instances through unity inspector. The whole idea of this is to let code be flexible and not know what particular implementations we use which is polymorphic thing. Sometimes we don't want to expose types for public use in code.
For example I have next implementation (code below):
Here I have some IStartup implementation which have injected fields which is why I don't want to serialize it. So I have IStartupConfig which just creates IStartup being just dumb serializable data container with one method. This way I perfectly can assign composition of IStartup modules through ScriptableObject with IStartupConfig[] array.
But RestoreCardEveryTurn.Config should be public and there is no case I want to use it from code, because again this class specifically for serialization in editor.
It is powerful thing to have implementations private while still be able to assign instances through unity inspector. The whole idea of this is to let code be flexible and not know what particular implementations we use which is polymorphic thing. Sometimes we don't want to expose types for public use in code.
For example I have next implementation (code below):
Here I have some
IStartup
implementation which have injected fields which is why I don't want to serialize it. So I haveIStartupConfig
which just createsIStartup
being just dumb serializable data container with one method. This way I perfectly can assign composition ofIStartup
modules throughScriptableObject
withIStartupConfig[]
array.But
RestoreCardEveryTurn.Config
should bepublic
and there is no case I want to use it from code, because again this class specifically for serialization in editor.The text was updated successfully, but these errors were encountered: