Hide menu
Unity Base Viewer Example

Reads an external CAD file and translates its contents into Unity objects at runtime.

unityruntimeimport.png

Description

After opening the example scene in the Unity Editor, you see simple scene with camera, canvas, etc.

unityruntimeimportexample.png

"Main Camera" object has two attached components:

  • Camera Control - a primitive camera control script
  • Model Loader - a CAD Exchanger integration script
unityruntimeimportcomponents.png

The ModelLoader script reads a CAD file into a ModelData_Model object in memory.
Then it uses the Unity_ObjectFactory to convert this object to Unity's GameObject:

...
Unity_ObjectFactory aFactory = new Unity_ObjectFactory();
GameObject aTarget = aFactory.Create (aLoadedModel, "MyModelName");
...

Preparation

Before running the example follow the steps described here.

Launching

Once you start the example application, you will see a window with a single button "Load model". By clicking on it, you get access to the file system and can choose the model to load.

To work with the file system, we used the "Runtime File Browser" plugin.

Note
You can use this or other plugins in your project or write your own plugin to access the file system.

Files

3rd party software

This example uses the open source plugin "Runtime File Browser" available under the MIT license.