예제 #1
0
	public static void AddAlwaysIncludedShader(string shaderName)
	{
#if UNITY_EDITOR
	    Shader shader = Shader.Find(shaderName);

	    if (shader == null)
	        return;

            UnityEngine.Rendering.GraphicsSettings graphicsSettings = 
	        AssetDatabase.LoadAssetAtPath<UnityEngine.Rendering.GraphicsSettings>("ProjectSettings/GraphicsSettings.asset");
	    SerializedObject serializedObject = new SerializedObject(graphicsSettings);
	    SerializedProperty arrayProp = serializedObject.FindProperty("m_AlwaysIncludedShaders");
	    bool hasShader = false;

	    for (int i = 0; i < arrayProp.arraySize; i++)
	    {
	        SerializedProperty arrayElem = arrayProp.GetArrayElementAtIndex(i);
	        if (shader == arrayElem.objectReferenceValue)
	        {
	            hasShader = true;
	    	    break;
	        }
	    }

	    if (!hasShader)
	    {
	        int arrayIndex = arrayProp.arraySize;
	        arrayProp.InsertArrayElementAtIndex(arrayIndex);
	        SerializedProperty arrayElem = arrayProp.GetArrayElementAtIndex(arrayIndex);
	        arrayElem.objectReferenceValue = shader;
	        serializedObject.ApplyModifiedProperties();
	        AssetDatabase.SaveAssets();
	    }
#endif
	}
예제 #2
0
        static StackObject *Ctor_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *__ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new UnityEngine.Rendering.GraphicsSettings();

            return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method));
        }
예제 #3
0
        static int __CreateInstance(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);

            try {
                if (LuaAPI.lua_gettop(L) == 1)
                {
                    UnityEngine.Rendering.GraphicsSettings __cl_gen_ret = new UnityEngine.Rendering.GraphicsSettings();
                    translator.Push(L, __cl_gen_ret);

                    return(1);
                }
            }
            catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.Rendering.GraphicsSettings constructor!"));
        }