Skip to content

breiting/ckk-upm-rex-rexfile-io

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

upm-rex-rexfile-io

Unity Package for REXfile input and output

Installation

To install use Add package from git URL... function in the Unity Package Manager. The package is inside the path Assets/package therefore the git URL should look like this:

https://github.com/roboticeyes/upm-rex-rexfile-io.git?path=/Assets/package

To select a specific version add #version to the url e.g.: https://github.com/roboticeyes/upm-rex-rexfile-io.git?path=/Assets/package#v1.0.17

Usage

An example Scene can be found under Assets/Example

Convert .rex to GameObjects

This code starts an conversion from .rex to GameObjects

byte[] data = File.ReadAllBytes ("rexFile");
RexConverter.Instance.ConvertFromRex (data, (success, loadedObjects) =>
{
    if (!success)
    {
        Debug.Log ("ConvertFromRex failed.");
        return;
    }

    List<MeshFilter> meshFilters = new List<MeshFilter> ();
    foreach (var item in loadedObjects.Meshes)
    {
        item.gameObject.SetActive (true);
        meshFilters.Add (item.GetComponentInChildren<MeshFilter>());
    }
});

Convert Meshes to .rex

MeshFilter[] meshesToWrite;
...
byte[] rexFile = RexConverter.Instance.GenerateRexFile (meshesToWrite);

What is REX?