Exemplo n.º 1
0
        internal static T[] GetNativeArray <T>(NativeToManagedArray <T> method)
        {
            int arraySize = method(null, 0);

            if (arraySize <= 0)
            {
                return(new T[0]);
            }

            T[] array = new T[arraySize];
            method(array, arraySize);
            return(array);
        }
Exemplo n.º 2
0
        internal static string GetNativeString(NativeToManagedArray <byte> nativeToManagedCharArray)
        {
            string str = null;

            byte[] charArr = GetNativeArray(nativeToManagedCharArray);

            if (charArr != null && charArr.Length > 0)
            {
                try
                {
                    str = Encoding.UTF8.GetString(charArr);
                }
                catch (Exception e)
                {
                    Debug.LogError("Exception creating string from char array: " + e);
                }
            }

            return(str);
        }