Working With UnityLink
UnityLink provides functionality for integrating Unity and the Wolfram Language. It allows you make calls to Unity from the Wolfram Language and vice versa.
Basic hierarchy of Unity objects
Scenes are used to divide your game into different parts, such as menu screens and individual levels. In the Wolfram Language, scenes are represented as UnityScene objects.
- A scene contains all the objects of your game, called GameObjects.
Unity Game Objects
Game objects are the most important object in Unity. Everything from players to lighting requires a game object to function. In the Wolfram Language, game object are represented as UnityGameObject objects.
- On their own, game objects can’t do much. To have elements such as rendering, lighting, audio, and physics, you have to add components to your game objects.
Unity Game Object Components
Game object components allow you to add functionality such as physics and audio to a game object. By default, every game object has a transform component that specifies its position, scale, and orientation within the scene. In the Wolfram Language, transform components are represented as UnityTransform objects.
- Possible game object components include UnityBoxCollider, UnityLight, and UnityCamera. See Unity Objects And Components guide page for a detailed information.
Assets are files stored within the “Assets” folder of a Unity project. They are often used by game object components and may come from external programs. Typical assets includes 3D models, audio clips and textures which are represented in UnityLink as UnityMesh, UnityAudioClip and UnityTexture2D respectively.
- Scenes, prefabs, and scripts are also considered assets.
Create, Find and Delete
Scenes, game objects, components and assets can be created, searched for and deleted from the Wolfram Language. The example below shows how to create, find, and delete a ball game object.
- Components have a common search function FindUnityComponent.