blob: 56e24518a9f9179c81e1a8a4242a85119000ace4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
namespace AmplifyShaderEditor
{
// Catch when scene is saved (Ctr+S) and also save ase shader
public class SceneSaveCallback : UnityEditor.AssetModificationProcessor
{
private const string UnityStr = ".unity";
static string[] OnWillSaveAssets( string[] paths )
{
bool canSave = false;
if ( paths.Length == 0 )
{
canSave = true;
}
else
{
for ( int i = 0; i < paths.Length; i++ )
{
// Only save shader when saving scenes
if ( !string.IsNullOrEmpty( paths[ i ] ) && paths[ i ].Contains( UnityStr ) )
{
canSave = true;
break;
}
}
}
if ( canSave && UIUtils.CurrentWindow )
UIUtils.CurrentWindow.SetCtrlSCallback( false );
return paths;
}
}
}
|