本文整理汇总了C#中UnityEngine.ProceduralMaterial.SetProceduralFloat方法的典型用法代码示例。如果您正苦于以下问题:C# ProceduralMaterial.SetProceduralFloat方法的具体用法?C# ProceduralMaterial.SetProceduralFloat怎么用?C# ProceduralMaterial.SetProceduralFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.ProceduralMaterial
的用法示例。
在下文中一共展示了ProceduralMaterial.SetProceduralFloat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnGUI
void OnGUI()
{
GUILayout.BeginArea(new Rect(10, 10, Screen.width / 6, Screen.height - 20));
scrollViewVector = GUILayout.BeginScrollView(scrollViewVector);
//scrollViewVector = GUI.BeginScrollView(new Rect(10, 10, Screen.width / 6, Screen.height - 20), scrollViewVector, new Rect(10, 10, Screen.width / 6, Screen.height*5));
string[] bn = new string[buttonNames.Count()];
for (int i = 0; i < buttonNames.Count(); i++)
{ bn[i] = buttonNames[i]; }
button_selected = GUILayout.SelectionGrid(button_selected, bn, 1);
GUILayout.EndScrollView();
GUILayout.EndArea();
//mt = Materials[button_selected];
GUILayout.BeginArea(new Rect(Screen.width - (Screen.width / 6), 10, Screen.width / 6, Screen.height - 20));
Object.GetComponent<Renderer>().sharedMaterial = Materials[button_selected];
mt_proc = Object.GetComponent<Renderer>().sharedMaterial as ProceduralMaterial;
//material_arguments.Clear();
material_arguments = new List<ProceduralPropertyDescription>();
material_arguments = mt_proc.GetProceduralPropertyDescriptions().Select(m => { return m; }).ToList();
//prop_values = new float[material_arguments.Count()];
//this.prop_values = new List<float>();
//int ind = 0;
GUILayout.BeginScrollView(Vector2.zero);
foreach (ProceduralPropertyDescription desc in material_arguments)
{
Debug.Log(desc.GetType());
if (desc.type == ProceduralPropertyType.Float)
{
//prop_values[ind] = GUILayout.HorizontalSlider(prop_values[ind], desc.minimum, desc.maximum);
GUILayout.TextField(desc.name);
mt_proc.SetProceduralFloat(desc.name, GUILayout.HorizontalSlider(mt_proc.GetProceduralFloat(desc.name), desc.minimum, desc.maximum));
//ind++;
}
//else Debug.Log("There is no float");
}
GUILayout.EndScrollView();
//foreach (var m in mt_proc.GetProceduralPropertyDescriptions()) { material_arguments.Add(m); Debug.Log(m.name); }
//arg.Clear();
//arg = new List<float>();
//argument = GUILayout.HorizontalSlider(argument, 0, 1);
//arg.Add(argument);
//mt_proc.SetProceduralFloat("Age", argument);
mt_proc.RebuildTextures();
// Object.GetComponent<Renderer>().sharedMaterial = mt_proc;
GUILayout.EndArea();
}