#Non-Versioning Debug Value of ScriptableObject

1 messages · Page 1 of 1 (latest)

lusty elbow
#

How do you handle value that shouldn't be saved in versionning of your ScriptableObject because they are only temporary debug value here to help developer and game designer during editing ?

Is a separate Debug ScriptableObject added to gitignore the only sane solution ?

floral needle
#

What if you just don't serialize these debug values?

foggy hollow
#

If the value needs to be serialized, but shouldn't be version-controlled, then yeah, you need a separate asset

#

note that you can often get away without actually serializing something – as long as the value doesn't need to survive a reload from disk

#

a custom inspector can display these non-serialized values

#

(the undo system won't know about them)

lusty elbow
#

I need to serialize them because I don't want to set them again and again each time I click play.

floral needle
lusty elbow
#

Boolean, Integer, Asset Reference, Prefab Reference, basically every value I need to override in debug.
Exemple : set a specific boss pattern to test

wicked shale
#

It does sound like you should just swap to a different SO when debugging

#

That's where SO's shine, easily swapping references/configs

velvet berry
#

Exactly. Easy to have 2 references and you can pick based on DEBUG being defined

foggy hollow
#

You could also have a static method that "resolves" an asset reference into another asset reference based on whether you're in debug mode

#

you'd configure it with pairs of assets

#

so if you give it a boss definition, it hands you either:

  • the same definition
  • a replacement
#

This would avoid touching your real game data at all

#

You could use the [Conditional] attribute so that it's completely impossible to even try to do a swap outside of the editor/a debug build, too

#
BossSpec spec;

void StartBoss() {
  AssetReplacer.Resolve(ref spec);
  spec.DoSomethingIDK();
}
#

the Resolve method would do a switcheroo on you