#Scriptable Objects access scope

1 messages · Page 1 of 1 (latest)

bold dust
#

Same rules apply to SO as to everything, you never use wider access modifier than you need to. If you need an object somewhere you should always pass it as a dependency, then use as private. Then it's much easier to debug problems.

#

The use case as public object, could be when you use immutable SO assets as a type of something, as a default inventory set for example for a unit type, or entire data for the unit. You may also instantiate it and use as local data holder for that unit, at that point reference access should be locked to that usnit and accessed with unit's methods.

#

These kind of workflow you learn to appreciate when the project increases in scale and you have to debug a lot

tidal lodge
#

Yeah. I'm starting work on a larger project at the moment and I predict a great deal of debugging. I don't fully understand this atm, but if I can, I'll use best practices - and everybody seems keen on using SOs everywhere. =D Thanks for the advice!