Get RAPTOR

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:

SlotReplacesType
SaveSave modelModelOp: bool (RaptorModel model, out string notice)
SaveAndUnloadSave and unloadModelOp
LoadLoad into sceneLoadOp
RenameRename in ModelsRenameOp
RenameRefusalThe reason a rename is not allowedFunc<string, string, string>
LightStateThe Baked, Stale and Unbaked states in ModelsLightOp
ModelsRootThe folder Models listsstring
BakeReplacesAnotherWhether a bake would overwrite another saved model's meshesFunc<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:

ChoiceWhat happens
Built-inThe default. Empty slots use RAPTOR's store.
Provider onlyIf 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.