public override void OnInspectorGUI() { DrawDefaultInspector(); ShellMaterial myScript = (ShellMaterial)target; if (GUILayout.Button("Toggle")) { myScript.toggle(); } }
private void ReadMaterial(string line) { ParseLine(line, out _, out var values); ParseLine(values, out var shellName, out var colorString); TryParseDoubleArray(colorString, out var shellColor); var r = (float)shellColor[0]; var g = (float)shellColor[1]; var b = (float)shellColor[2]; var currentColor = new Color(r, g, b); Material = new ShellMaterial(shellName, currentColor); }
private void ReadMaterial(string line) { float r = 0, g = 0, b = 0; string id, values, shellName, colorString; double[] shellColor; ParseLine(line, out id, out values); ParseLine(values, out shellName, out colorString); TryParseDoubleArray(colorString, out shellColor); r = (float)shellColor[0]; g = (float)shellColor[1]; b = (float)shellColor[2]; var currentColor = new Color(r, g, b); Material = new ShellMaterial(shellName, currentColor); }