public static Texture2D LoadPNG(string filePath) //Loads a png from a file and returns it (Loads the asset into memory, do only load it once)
        {
            byte[] spriteBytes;
            using (var fileStream = File.OpenRead(filePath))
                using (var reader = new BinaryReader(fileStream))
                {
                    var png = PNGTools.ReadPNGFile(reader);
                    for (int i = png.chunks.Count - 1; i >= 0; i--)
                    {
                        var c = png.chunks[i];
                        if (c.type == EChunkType.gAMA ||
                            c.type == EChunkType.pHYs ||
                            c.type == EChunkType.sRBG)
                        {
                            png.chunks.RemoveAt(i);
                        }
                    }
                    using (var mem = new MemoryStream())
                    {
                        PNGTools.WritePNGFile(png, new BinaryWriter(mem));
                        spriteBytes = mem.ToArray();
                    }
                }

            var tex = new Texture2D(512, 512, TextureFormat.RGBA32, true, false);

            tex.LoadImage(spriteBytes); //This resizes the texture width and height
            tex.filterMode = FilterMode.Trilinear;
            tex.anisoLevel = 9;
            tex.mipMapBias = -0.5f;

            return(tex);
        }
        public uint CalcCRC()
        {
            var crc = PNGTools.UpdateCRC(0xFFFFFFFF, (uint)type);

            crc = PNGTools.UpdateCRC(crc, data);
            return(crc ^ 0xFFFFFFFF);
        }