Ejemplo n.º 1
0
    /// <summary>
    /// When we change playmode, we make sure to reset all iml models
    /// </summary>
    /// <param name="playModeStatus"></param>
    private static void PlayModeStateChangedLogic(PlayModeStateChange playModeStatus)
    {
        // We load models if we are entering a playmode or editormode
        if (playModeStatus == PlayModeStateChange.EnteredEditMode || playModeStatus == PlayModeStateChange.EnteredPlayMode)
        {
            // Reload all models (if we can) when we enter playmode or when we come back to the editor
            foreach (var MLComponent in m_IMLComponents)
            {
                // Reload models
                MLComponent.LoadAllModelsFromDisk();
                // Run them (if marked with RunOnAwake)
                MLComponent.RunAllModels();
            }
            //Debug.Log("**Models reconfigured in editor status: " + playModeStatus + "**");
        }

        // We save models if we are leaving a playmode or editormode
        if (playModeStatus == PlayModeStateChange.ExitingEditMode || playModeStatus == PlayModeStateChange.ExitingPlayMode)
        {
            foreach (var MLComponent in m_IMLComponents)
            {
                MLComponent.StopAllModels();
                MLComponent.SaveAllModels();
            }
        }
    }