當前位置: 首頁>>代碼示例>>C#>>正文


C# ProceduralMaterial.GetProceduralFloat方法代碼示例

本文整理匯總了C#中UnityEngine.ProceduralMaterial.GetProceduralFloat方法的典型用法代碼示例。如果您正苦於以下問題:C# ProceduralMaterial.GetProceduralFloat方法的具體用法?C# ProceduralMaterial.GetProceduralFloat怎麽用?C# ProceduralMaterial.GetProceduralFloat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.ProceduralMaterial的用法示例。


在下文中一共展示了ProceduralMaterial.GetProceduralFloat方法的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.GetProceduralFloat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。