Skip to content

Latest commit

 

History

History
110 lines (75 loc) · 5.83 KB

File metadata and controls

110 lines (75 loc) · 5.83 KB

Flax for Unity® developers

Unity to Flax

Flax and Unity have many similarities (C# scripting, physics engine) and share many concepts, however there are a few differences. This page helps Unity Engine developers to translate their existing Unity experience into the world of Flax Engine.

Warning

Warning! Once you switch from Unity to Flax you will love this engine!

Editor

Flax Editor and Unity Editor are very similar. You can see the color-coded, highlighted areas on screenshots of both editors that have common functionalities. Flax Editor layout is also highly customizable so you can drag and drop windows around to adapt the editor to your workflow.

Unity Editor

Flax Editor

Tip

You don't have to pay or buy any Pro version to have a Dark Theme in the Flax Editor.

Terminology

This section contains the most common terms used in Unity and their Flax equivalents (or rough equivalents). Flax keywords link directly to more in-depth information inside the documentation.

Unity Flax
GameObject Actor
MonoBehaviour Script
Shader Material
Material Material Instance
Hierarchy Panel Scene Window
Inspector Properties Window
Project Browser Content Window
Scene View Viewport

Project

Flax Project

Flax projects structure is similar to Unity projects. Instead of Library folder, editor uses Cache folder. Also Assets folder from Unity is splited into two separate parts: Content and Source. All C# script files are located in source directory so there is less mess with assets and scripts.

Flax also generates a solution and project files for your game C# scripts.

See Flax projects structure page to learn more about the projects in Flax Engine.

Assets

Flax doesn't use .meta files. Instead of it, every asset contains all required metadata information and is a self contained file. Files with extension .flax are using our own binary format that is well optimized for scalability and streaming. Other assets are usually stored in Json format (scenes, settings, etc.).

Flax supports the most popular asset files formats (for 3D models and textures) so you can import your game content.

See Assets page to learn more about importing and using game assets.

GameObject vs Actor

Flax doesn't use components to build scene objects logic. We use Actors. Each Actor has its own type (e.g. point light, box collider) and a collection of attached scripts. Also there is no TransformComponent but Actors have built-in transformation (less objects, more optimized design for bigger games). This means, in Flax the scene objects hierarchy is created with Actors, not by Transforms like in Unity.

However, you can still use the entity-component design with your scripts because every actor can have scripts like in Unity. Just instead of using GetComponent<T>() in your scripts, write GetChild<T>()/GetScript<T>().

In Flax, Scene object is also an Actor so you can access it like any other Actor. This means that Scenes can have their own scripts and be transformed like other objects.

MonoBehaviour vs Script

When it comes to game scripting, Unity and Flax are very similar. The are some differences in C# API (Flax has bigger math library, is more performance-oriented and uses new C# 7.2). In fact, the whole C# editor and C++ engine including scripting API is open and can be found here. All contributions are welcome.

Also, Flax support native C++ scripting and Visual Scripting as an in-build feature. We don't want to limit our developers to just a one programming language for the game development as using C++ and Visual Scripting together with C# can benefit.

If you write C# scripts simply replace MonoBehaviour with Script as it makes more sense (and is shorter to write).

  • Unity
public class MyScript : MonoBehaviour
{
	void Start()
	{
		Debug.Log("It is Unity!");
	}
}
  • Flax
public class MyScript : Script
{
	public override void OnStart()
	{
		Debug.Log("It is Flax!");
	}
}

See Scripting documentation to learn more about C# scripts in Flax.

Cool things in the C# API

If you're a programmer here is a list of new cool things in Flax C# API that may be useful:

  • Engine and Editor are open with full source code (link)
  • You can edit all input settings at runtime (link)
  • You can change the gamepad devices layout at runtime (link)
  • You can dynamically set Update/Draw/Physics FPS (link)
  • You can serialize/deserialize any objects to json (link)
  • You can use a huge math library (link)
  • You can perform custom rendering on GPU (link)
  • You can use Custom Editors pipeline to create great editor extensions (link)

Unity® is a trademark of Unity Technologies.