Model storage
Replace how RAPTOR saves, loads and renames models.
By default, Save model writes each model as an editable prefab at <Models>/<name>/<name>.prefab, where <Models> is Assets/RAPTOR Data/Models. See Models for the editor workflow.
A model provider is project code that replaces RAPTOR's save, load and rename operations. Each filled slot replaces one operation, and empty slots use RAPTOR's built-in store.
The slots
The slots are on RaptorModelStorageSlots:
| Slot | Replaces | Type |
|---|---|---|
Save | Save model | ModelOp: bool (RaptorModel model, out string notice) |
SaveAndUnload | Save and unload | ModelOp |
Load | Load into scene | LoadOp |
Rename | Rename in Models | RenameOp |
RenameRefusal | The reason a rename is not allowed | Func<string, string, string> |
LightState | The Baked, Stale and Unbaked states in Models | LightOp |
ModelsRoot | The folder Models lists | string |
BakeReplacesAnother | Whether a bake would overwrite another saved model's meshes | Func<RaptorModel, bool> |
Each operation returns true when it completes. notice is the short message RAPTOR shows afterwards, such as Saved. Leave notice null if the user cancelled.
Wrap the built-in store
To add steps before or after RAPTOR's operations, call RaptorModelStore from your provider:
using Raptor.EditorTools;
using UnityEditor;
[InitializeOnLoad]
static class MyModelStorage
{
static MyModelStorage()
{
RaptorModelStorageSlots.Save = (model, out string notice) =>
{
bool saved = RaptorModelStore.Save(model, out notice);
if (saved) MyAssetIndex.Add(model.name); // your own step
return saved;
};
RaptorModelStore.RequireProvider();
}
}Provider only
Edit → Project Settings → RAPTOR → Models → Model storage has two choices:
| Choice | What happens |
|---|---|
| Built-in | The default. Empty slots use RAPTOR's store. |
| Provider only | If the provider's scripts fail to load, Save and Load fail with No storage provider instead of using the built-in store. |
The row shows Provider: on or Provider: none.
Call RaptorModelStore.RequireProvider() from your load hook. On its first call, it sets the project to Provider only, so a broken provider cannot cause models to be saved in the wrong place.
Lightmaps are not part of a saved model
Unity stores lightmaps per scene, so a loaded model needs its lighting baked again.