예제 #1
0
 private void LoadIfNeeded()
 {
     if (_animationTexture == null && _asset != null)
     {
         BinaryReader reader = new BinaryReader(new MemoryStream(_asset.bytes));
         _animationTexture = GPUAnimationsIO.Read(reader);
     }
 }
                    private static void SaveAnimationTexture(GPUAnimations animationTexture, string fileName)
                    {
                        string directory = Path.GetDirectoryName(fileName);

                        if (!Directory.Exists(directory))
                        {
                            Directory.CreateDirectory(directory);
                        }

                        FileStream   file   = File.Open(fileName, FileMode.Create);
                        BinaryWriter writer = new BinaryWriter(file);

                        GPUAnimationsIO.Write(animationTexture, writer);

                        file.Close();

#if UNITY_EDITOR
                        //Refresh the saved asset
                        AssetUtils.RefreshAsset(fileName);
#endif
                    }