当前位置: 首页>>代码示例>>C#>>正文


C# ProceduralMaterial.SetProceduralFloat方法代码示例

本文整理汇总了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();
    }
开发者ID:pmpu,项目名称:3DRecreator,代码行数:47,代码来源:GUI_Script.cs


注:本文中的UnityEngine.ProceduralMaterial.SetProceduralFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。