I have a few ScriptableObjects that act as configuration files for various things, like physics layers for example. It lets me keep track of which layers represent physical objects, characters, camera-blockers, etc.
Previously I was using AssetDatabase functions to load the Physics Settings.asset, but now that I have to build it I need to use something else. I’m assuming it’s Resources.Load or something, but I can’t figure out exactly what the function is supposed to look like. Basically I want to do this, but the configuration file I’ve created never loads up:
public static PhysicsSettings GetPhysicsSettingsAt (string path, string name) {
string fullPath = path + "/" + name;
PhysicsSettings file = Resources.Load (fullPath, typeof (PhysicsSettings)) as PhysicsSettings;
Debug.Log (fullPath);
if (!file) {
file = ScriptableObject.CreateInstance<PhysicsSettings> () as PhysicsSettings;
file.name = name;
}
return file;
}