예제 #1
0
        private static IntPtr AllocateArray(long size)
        {
            if (size < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(size), "Array size must not be negative");
            }

            var elementTypeClassPointer = Il2CppClassPointerStore <string> .NativeClassPtr;

            if (elementTypeClassPointer == IntPtr.Zero)
            {
                throw new ArgumentException("String class pointer is missing, something is very wrong");
            }
            return(IL2CPP.il2cpp_array_new(elementTypeClassPointer, (ulong)size));
        }
        private static IntPtr AllocateArray(long size)
        {
            if (size < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(size), "Array size must not be negative");
            }

            var elementTypeClassPointer = Il2CppClassPointerStore <T> .NativeClassPtr;

            if (elementTypeClassPointer == IntPtr.Zero)
            {
                throw new ArgumentException($"{nameof(Il2CppStructArray<T>)} requires an Il2Cpp reference type, which {typeof(T)} isn't");
            }
            return(IL2CPP.il2cpp_array_new(elementTypeClassPointer, (ulong)size));
        }