So here are my first steps:
I got the Custom Editor Panel working, but I don´t know how to access the exposed Properties of my substance Materials (for now, it´s just the exposed Paintwear Property on Substance Material "EB02", which is a graph inside EB13.sbsar)
here is my code:
using UnityEngine;
using UnityEditor;
using System.Collections;
public class EB_Editor : EditorWindow
{
bool groupEnabled1;
bool groupEnabled2;
float PaintWear = 0.5F;
float PaintDirt = 0.5F;
Color GlobalColor;
ProceduralMaterial substance;
//Add menu named "EB_Editor" to the Window Menu
[MenuItem ("Window/EB_Editor")]
static void Init ()
{
//Get existing open window or if none, make a new one:
EB_Editor window = (EB_Editor)EditorWindow.GetWindow (typeof (EB_Editor));
}
//EB_Editor Content
void OnGUI ()
{
GUILayout.Label ("EB GLobal Values", EditorStyles.boldLabel);
//start GUI Layout test
groupEnabled1 = EditorGUILayout.BeginToggleGroup ("Layout Test", groupEnabled1);
PaintWear = EditorGUILayout.Slider ("PaintWear", PaintWear, 0, 1);
PaintDirt = EditorGUILayout.Slider ("PaintDirt", PaintDirt, 0, 1);
EditorGUILayout.EndToggleGroup ();
//end GUI Layout test
//here I want to dispatch the Custom PaintWear Value to the substance Materials Paintwear property
groupEnabled2 = EditorGUILayout.BeginToggleGroup ("Substance Properties", groupEnabled2);
GUILayout.TextArea ("trying to access Substance Properties");
ProceduralMaterial substance = Resources.Load("EB02", typeof(ProceduralMaterial)) as ProceduralMaterial;
PaintWear = GUILayout.HorizontalSlider(PaintWear, 0.0F, 1.0F);
//as soon as I comment out the following two lines, at least the editor panel layout works:
substance.SetProceduralFloat("Paintwear", PaintWear);
substance.RebuildTextures ();
EditorGUILayout.EndToggleGroup ();
}
}
any help appreciated!