Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 675 Bytes

raw-data-asset.md

File metadata and controls

20 lines (14 loc) · 675 Bytes

Raw Data Asset

Raw Data Asset is a general purpose data container that is designed to store an array of raw bytes.

Example code

Here is an example usage code that creates a virtual assets, sets its data and saves it to file.

var myAsset = Content.CreateVirtualAsset<RawDataAsset>();
myAsset.Data = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9};
myAsset.Save(Path.Combine(Globals.ProjectContentFolder, "MyData.flax"));

Then you can load the asset or reference is in the script and use in your game.

var myAsset = Content.Load<RawDataAsset>(Path.Combine(Globals.ProjectContentFolder, "MyData.flax"));
Debug.Log("Data size: " + myAsset.Data.Length);