Recently, I've been working on the core of my engine, and as I'm moving forward I find myself developing throwaway code to read files and simple data into the engine. This got me thinking about how I should implement a file management system.

After a bit of googleing I came across the Unreal Package format, and boy does it look like the perfect one.

I think it's good because the way how it allows you to separate different assets into different packages and allow something like a level to reference the different packages.

I was just wondering, is this possible with C#? Because the built-in serialization API in .NET does not seem to support any form of this, only reading and writing to a single file.


1 Answer 1


Yes it's possible. You don't have to use the built in serialization API. Create your own serialization methods for the objects you want to read/write to disk.

You can make heavy use of the BitConverter method GetBytes, for writing your data. As well as the various ToType() methods for reading your binary data.

Writing your own means you're in full control of how the data is written. You can structure it however you want, in whatever directory structure you want.

  • \$\begingroup\$ Ahhh, yes that's true. That will definitely help. Also I was thinking on how to save the objects. When a new object is created in the editor, the user needs to specify the package that is going to reside in (or create a new one if needed). Then, when the time comes when the object is actually saved, I just parse all the root objects and ask them to save their contents to the specific package. What do you think? \$\endgroup\$ Commented Oct 18, 2012 at 21:12
  • \$\begingroup\$ Sounds like a good plan. When my objects have other objects in them, I just have the parent object call the save method on the child objects. Passing along whatever file pointer is needed. Just save down the hierarchy and read the same way. Works great. \$\endgroup\$
    – House
    Commented Oct 18, 2012 at 21:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .