Exemplo n.º 1
0
            public override void OnInspectorGUI()
            {
                EditorGUILayout.LabelField("you probably should not edit this file in inspector");
                PathFinderSettings s = (PathFinderSettings)target;

                if (s == null)
                {
                    return;
                }

                EditorGUILayout.LabelField("some links to important files:");
                s.ComputeShaderRasterization2D = (ComputeShader)EditorGUILayout.ObjectField("CS Rasterization 2D", s.ComputeShaderRasterization2D, typeof(ComputeShader), false);
                s.ComputeShaderRasterization3D = (ComputeShader)EditorGUILayout.ObjectField("CS Rasterization 3D", s.ComputeShaderRasterization3D, typeof(ComputeShader), false);
            }
Exemplo n.º 2
0
        public static PathFinderSettings LoadSettings()
        {
            PathFinderSettings result = Resources.Load <PathFinderSettings>(SETTINGS_ASSET_NAME);

#if UNITY_EDITOR
            if (result == null)
            {
                result = CreateInstance <PathFinderSettings>();

                result.areaLibrary = new List <Area>();
                result.areaLibrary.Add(new Area("Default", 0, Color.green));
                result.areaLibrary.Add(new Area("Not Walkable", 1, Color.red)
                {
                    cost = float.MaxValue
                });

                AssetDatabase.CreateAsset(result, String.Format("{0}/{1}/{2}/{3}.asset", new string[] { "Assets", PROJECT_FOLDER, RESOURSES_FOLDER, SETTINGS_ASSET_NAME }));
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
#endif
            return(result);
        }