StringExtensions.cs 294 B

123456789101112
  1. using UnityEngine;
  2. using System.Collections;
  3. public static class StringExtensions {
  4. public static byte[] GetBytes(this string str)
  5. {
  6. byte[] bytes = new byte[str.Length * sizeof(char)];
  7. System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
  8. return bytes;
  9. }
  10. }