Export A-Frame From Unity Scene.
Compatible with A-Frame version 1.1.0+.
- Clone this repository
- Copy "AFrameExporter" and "CombineMeshes" Folder to your project from repository
- Open your project from Unity3D.
- Open scene you want to export.
- Click AFrameExporter prefab to show exporter inspector.
- Click Export button on inspector.
- Find the
index.html
file in your project Assets folder underAssets/AFrameExporter/export/index.html
- Launch a local web server in the
/export
folder usingpython3 -m http.server
to view the result athttp://localhost:8000
Note 1, you may need to copy .png
images into the folder Assets/AFrameExporter/export/images
for textures used by your scene.
Note 2, some models render better using gltf format, instead of obj. You can convert your models using gltf-exporer from within Unity and save to your /export/models
directory. Finally, edit your exported index.html to load the gltf by changing the <a-obj-model>
tag to <a-gltf-model src="models/your_model.gltf"></a-gltf-model>
Note 3, Linux users may need to install the following libraries: sudo apt install libc6-dev
and sudo apt install libgdiplus
.
To add spatial sound effects to your VR scene, use the following steps below.
- Download sound effects (mp3, wav) and copy to
Assets/AFrameExporter/export/sounds
. - In your
index.html
file, add the following section:<assets> <audio id="mysound" src="mysound.mp3" preload="auto"></audio> </assets>
- To add sound to a specific object, use the following example:
<a-box src="url(images/box.png); audio="src: #mysound; loop: true; distance: 8;"></a-box>
Sound effects use Howler.js and are compatible with Chrome, Safari, mobile devices, Android, and Apple iPhone iOS.
loop: boolean, true to play sound effect continuously, default is false
volume: integer, default is 1
distance: integer, how close the camera must be to the object before playing audio, default is 8
fade: integer, how quickly the sound fades when moving away from the object, default is 5000
âGeneral
ă»Title
Title of A-Frame.
ă»Library Address
A-Frame library address you want to use.
ă»Enable_performance_statistics
Show Performance Statistics.
âSky
ă»Enable_Sky
Enable A-Frame Sky.
ă»Sky_color_from_Main Camera_Background
Use sky color from Main Camera Background.
ă»Sky_color
Sky color.
ă»Sky_texture
Sky texture.
âCamera
ă»Wasd_controls_enabled
Enable WASD control.
ă»Look_controls_enabled
Enable Look control.
ă»Enable_Sky
Enable A-Frame Sky.
ă»Cursor_visible
Change cursor visible.
ă»Cursor_opacity
Change cursor opacity.0 to 1.
ă»Cursor_scale
Change cursor scale.
ă»Cursor_color
Change cursor color.
ă»Cursor_offset
Change cursor offset.
ă»Cursor_maxdistance
Change cursor max distance.
âClear Exported Files
Clean exported files.
If you editted export folder. These file will be deleted.
ă»Main Camera
Supported parameters are Position, Rotation, Fov, NearClip, FarClip.
ă»Light
Directional, Point, Spot
Supported parameters are Position, Rotaion, Intensity, Color.
ă»Single Sprite
Export as Image.
ă»Cube
Export as Box.
Supported parameters are Scale xyz.
ă»Sphere
Export as Sphere.
Scale parameters are exported average xyz. because A-Frame Sphere have parameter only radius.
ă»Cylinder
Export as cylinder.
Scale y export as height.
Scale xz are exported average for A-Frame cylinder radius.
ă»Plane
Export as plane.
ă»Other Meshes
Export as Obj.
ă»Physics Engine
Using the aframe-particle-system-component.
ă»Sound Engine
Using Howler.js with spacial audio to play sound effects as you approach objects. See example for how to add to your VR objects.
ă»You can't use Asset from Unity Asset Store limited of EULA.
But, you can ask asset developer about it.
ă»If you editted index.html in export folder, and re-export , It will be deleted.
Before edit A-Frame, please copy export folder to another directory.
ă»Export only main texture from object.
ă»Standard ă»Unlit/Color ă»Unlit/Texture ă»Unlit/Texture Colored ă»Legacy Shaders/Transparent/Diffuse