コード例 #1
0
ファイル: UNOShaderSettings.cs プロジェクト: happylays/tbb2
    public static void Init()
    {
        if (inited & UNOShaderDataGameObject != null & UNOShaderDirCorrectPath == true)
        {
            return;
        }

        inited = true;
        AssetDatabase.Refresh();
        Object tempFolder = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin", typeof(Object)) as Object;


        //================================================ Path Checking
        if (tempFolder == null)
        {
            UNOShaderDirCorrectPath = false;
        }
        else
        {
            UNOShaderDirCorrectPath = true;
        }

        {
            //================================================ Render settings
            //renderSettings = Object.FindObjectOfType(typeof(RenderSettings)) as RenderSettings;// assigns renderSettings

            //================================================ UnoShader Data
            UNOShaderDataGameObject = GameObject.Find("UNOShaderData");
            if (UNOShaderDataGameObject != null)
            {
                UNOShaderDataGameObject.hideFlags = HideFlags.HideInHierarchy;
                comp_UNOShaderData = (UNOShaderData)UNOShaderDataGameObject.GetComponent <UNOShaderData>();
            }
            else
            {
                UNOShaderDataGameObject           = new GameObject();
                UNOShaderDataGameObject.name      = "UNOShaderData";
                UNOShaderDataGameObject.hideFlags = HideFlags.HideInHierarchy;
                UNOShaderDataGameObject.AddComponent <UNOShaderData>();
                comp_UNOShaderData = (UNOShaderData)UNOShaderDataGameObject.GetComponent <UNOShaderData>();
            }

            //================================================ UI texture paths
            UNOShaderFoldoutDown  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderFoldoutDown_file, typeof(Texture2D)) as Texture2D;
            UNOShaderFoldoutRight = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderFoldoutRight_file, typeof(Texture2D)) as Texture2D;
            UNOShaderEye          = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderEye_file, typeof(Texture2D)) as Texture2D;
            UNOShaderCheckBoxOff  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderCheckBoxOff_file, typeof(Texture2D)) as Texture2D;
            UNOShaderCheckBoxOn   = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderCheckBoxOn_file, typeof(Texture2D)) as Texture2D;
            UNOShaderWireframeOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderWireframeOff_file, typeof(Texture2D)) as Texture2D;
            UNOShaderWireframeOn  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderWireframeOn_file, typeof(Texture2D)) as Texture2D;
            UNOShaderHelpLink     = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderHelpLink_file, typeof(Texture2D)) as Texture2D;

            //--- Icons ---
            UNOShaderAnimation = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderAnimation_file, typeof(Texture2D)) as Texture2D;

            Icon_DirLightOn  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_DirLightOn_file, typeof(Texture2D)) as Texture2D;
            Icon_DirLightOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_DirLightOff_file, typeof(Texture2D)) as Texture2D;

            Icon_ProbeLightsOn  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ProbeLightsOn_file, typeof(Texture2D)) as Texture2D;
            Icon_ProbeLightsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ProbeLightsOff_file, typeof(Texture2D)) as Texture2D;

            Icon_VertexPointLightsOn  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_VertexPointLightsOn_file, typeof(Texture2D)) as Texture2D;
            Icon_VertexPointLightsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_VertexPointLightsOff_file, typeof(Texture2D)) as Texture2D;

            Icon_SpotPointLightsOn  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_SpotPointLightsOn_file, typeof(Texture2D)) as Texture2D;
            Icon_SpotPointLightsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_SpotPointLightsOff_file, typeof(Texture2D)) as Texture2D;

            Icon_ShadowsOn  = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ShadowsOn_file, typeof(Texture2D)) as Texture2D;
            Icon_ShadowsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ShadowsOff_file, typeof(Texture2D)) as Texture2D;
        }
    }
コード例 #2
0
    public static void Init()
    {
        if(inited & UNOShaderDataGameObject != null & UNOShaderDirCorrectPath == true)
        {
            return;
        }

        inited = true;
        AssetDatabase.Refresh();
        Object tempFolder = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin" ,typeof (Object))as Object;

        //================================================ Path Checking
        if( tempFolder == null )
        {
            UNOShaderDirCorrectPath = false;
        }
        else
        {
            UNOShaderDirCorrectPath = true;
        }

        {
            //================================================ Render settings
            //renderSettings = Object.FindObjectOfType(typeof(RenderSettings)) as RenderSettings;// assigns renderSettings

            //================================================ UnoShader Data
            UNOShaderDataGameObject = GameObject.Find("UNOShaderData");
            if (UNOShaderDataGameObject != null)
            {
                UNOShaderDataGameObject.hideFlags = HideFlags.HideInHierarchy;
                comp_UNOShaderData = (UNOShaderData)UNOShaderDataGameObject.GetComponent<UNOShaderData>();
            }
            else
            {
                UNOShaderDataGameObject = new GameObject();
                UNOShaderDataGameObject.name = "UNOShaderData";
                UNOShaderDataGameObject.hideFlags = HideFlags.HideInHierarchy;
                UNOShaderDataGameObject.AddComponent<UNOShaderData>();
                comp_UNOShaderData = (UNOShaderData)UNOShaderDataGameObject.GetComponent<UNOShaderData>();
            }

            //================================================ UI texture paths
            UNOShaderFoldoutDown = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderFoldoutDown_file,typeof(Texture2D))as Texture2D;
            UNOShaderFoldoutRight = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderFoldoutRight_file,typeof(Texture2D))as Texture2D;
            UNOShaderEye = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderEye_file,typeof(Texture2D))as Texture2D;
            UNOShaderCheckBoxOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderCheckBoxOff_file,typeof(Texture2D))as Texture2D;
            UNOShaderCheckBoxOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderCheckBoxOn_file,typeof(Texture2D))as Texture2D;
            UNOShaderWireframeOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderWireframeOff_file,typeof(Texture2D))as Texture2D;
            UNOShaderWireframeOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderWireframeOn_file,typeof(Texture2D))as Texture2D;
            UNOShaderHelpLink = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderHelpLink_file,typeof(Texture2D))as Texture2D;

            //--- Icons ---
            UNOShaderAnimation = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + UNOShaderAnimation_file,typeof(Texture2D))as Texture2D;

            Icon_DirLightOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_DirLightOn_file,typeof(Texture2D))as Texture2D;
            Icon_DirLightOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_DirLightOff_file,typeof(Texture2D))as Texture2D;

            Icon_ProbeLightsOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ProbeLightsOn_file,typeof(Texture2D))as Texture2D;
            Icon_ProbeLightsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ProbeLightsOff_file,typeof(Texture2D))as Texture2D;

            Icon_VertexPointLightsOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_VertexPointLightsOn_file,typeof(Texture2D))as Texture2D;
            Icon_VertexPointLightsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_VertexPointLightsOff_file,typeof(Texture2D))as Texture2D;

            Icon_SpotPointLightsOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_SpotPointLightsOn_file,typeof(Texture2D))as Texture2D;
            Icon_SpotPointLightsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_SpotPointLightsOff_file,typeof(Texture2D))as Texture2D;

            Icon_ShadowsOn = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ShadowsOn_file,typeof(Texture2D))as Texture2D;
            Icon_ShadowsOff = AssetDatabase.LoadAssetAtPath("Assets/" + UNOShaderDirPath + "Bin/UI/" + Icon_ShadowsOff_file,typeof(Texture2D))as Texture2D;
        }
    }