public override GameObject[] GetRootGameObjects(Scene scene)
        {
            if (!scene.isLoaded)
            {
                return(new GameObject[0]);
            }

            int handle = scene.handle;

            if (handle == -1)
            {
                return(new GameObject[0]);
            }

            int count = GetRootCount(handle);

            if (count < 1)
            {
                return(new GameObject[0]);
            }

            var list = new Il2CppSystem.Collections.Generic.List <GameObject>(count);

            var iCall = ICallManager.GetICall <d_GetRootGameObjects>("UnityEngine.SceneManagement.Scene::GetRootGameObjectsInternal");

            iCall.Invoke(handle, list.Pointer);

            return(list.ToArray());
        }
        public override bool LoadImage(Texture2D tex, byte[] data, bool markNonReadable)
        {
            var il2cppArray = (Il2CppStructArray <byte>)data;

            var iCall = ICallManager.GetICall <d_LoadImage>("UnityEngine.ImageConversion::LoadImage");

            return(iCall.Invoke(tex.Pointer, il2cppArray.Pointer, markNonReadable));
        }
        public override byte[] EncodeToPNG(Texture2D tex)
        {
            var iCall = ICallManager.GetICall <d_EncodeToPNG>("UnityEngine.ImageConversion::EncodeToPNG");

            IntPtr ptr = iCall.Invoke(tex.Pointer);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }

            return(new Il2CppStructArray <byte>(ptr));
        }
        public static Sprite CreateSpriteImpl(Texture texture, Rect rect, Vector2 pivot, float pixelsPerUnit, uint extrude, Vector4 border)
        {
            var iCall = ICallManager.GetICall <d_CreateSprite>("UnityEngine.Sprite::CreateSprite_Injected");

            var ptr = iCall.Invoke(texture.Pointer, ref rect, ref pivot, pixelsPerUnit, extrude, 1, ref border, false);

            if (ptr == IntPtr.Zero)
            {
                return(null);
            }
            else
            {
                return(new Sprite(ptr));
            }
        }
 public static int GetRootCount(int handle)
 {
     return(ICallManager.GetICall <d_GetRootCountInternal>("UnityEngine.SceneManagement.Scene::GetRootCountInternal")
            .Invoke(handle));
 }
        public override string LayerToName(int layer)
        {
            var iCall = ICallManager.GetICall <d_LayerToName>("UnityEngine.LayerMask::LayerToName");

            return(IL2CPP.Il2CppStringToManaged(iCall.Invoke(layer)));
        }
        public override void Blit(Texture2D tex, RenderTexture rt)
        {
            var iCall = ICallManager.GetICall <d_Blit2>("UnityEngine.Graphics::Blit2");

            iCall.Invoke(tex.Pointer, rt.Pointer);
        }