Difficulty: BEGINNER

With each release of Flexbox4Unity, you get multiple free layout algorithms. Usually you want to use the latest one, but if the latest one has fixed a bug you were relying on, or if it introduces new bugs, you may want to go back to an older version. You can do that with just a few clicks.

Fortunately, the layout-algorithms are modular: this means you can use any layout algorithm with any version of the Flexbox asset. You get the latest version of Flexbox4Unity (with all its features and fixes) but you can rollback the layout part to the exact code used in older versions of the asset.

Step 1: Choose your module

Unity needs you to have an Asset for each module you want to use (just like having a Texture or Model or Prefab – these assets live in your Project view).

The most commonly used layout-algorithms are pre-created as Assets for you – you can directly select them.

Step 1b: … create the Asset if necessary

If the algorithm you want to use doesn’t already have an Asset in the project, then you need to create it by:

  1. Right click in the Project view
  2. Select Create > Flexbox > Layout Algorithms
  3. Choose the one you want

Step 2: Enable the new module in Project Settings

Go to Project Settings (Menu: Edit > Project Settings), and select the “Flexbox” setttings. Here you have one or two fields for selecting the layout algorithm, and you can assign your asset from Step 1 / 1b to this slot.

At the bottom of this screenshot you can see the “Layout system” slots; here the algorithm in use is “Layout Algorithm v3.1.2”:

Step 3: v2 or v3?

The modules system changed completely from version 2 to version 3, so that Flexbox needs to know which version it’s using. If you only have one module selected, Flexbox will auto-detect the version. If you try to select a v2 and a v3 at the same time, Flexbox will use the lower version (v2). To stop using an unwanted algorithm, select it in the ProjectSettings field and hit Delete (it won’t delete it, it will simply unload that module and stop using it).