Example #1
0
        private static IntPtr EnsureNativePointer(UnityEngine.Texture tex)
        {
            IntPtr nativeTexturePtr = tex.GetNativeTexturePtr();

            if (nativeTexturePtr == IntPtr.Zero)
            {
                UnityEngine.RenderTexture renderTexture = tex as UnityEngine.RenderTexture;
                if (renderTexture != null)
                {
                    renderTexture.Create();
                }

                nativeTexturePtr = tex.GetNativeTexturePtr();
                if (nativeTexturePtr == IntPtr.Zero)
                {
                    throw new System.Exception("Can't create TextureSource, texture native pointer is null");
                }
            }

            return(nativeTexturePtr);
        }
Example #2
0
        static int _m_GetNativeTexturePtr(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.Texture __cl_gen_to_be_invoked = (UnityEngine.Texture)translator.FastGetCSObj(L, 1);


            try {
                {
                    System.IntPtr __cl_gen_ret = __cl_gen_to_be_invoked.GetNativeTexturePtr(  );
                    LuaAPI.lua_pushlightuserdata(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }