Prefabs are containers with a number of components and presets. They are comparable to *.fmx files in regular Delphi applications.

Prefabs are very helpful on storing and reusing sceneries in projects. You can store complex component hierarchies like in a default FMX formular file (*.fmx). We use the read/write mechanisms for prefabs with some additional functionality.

So it is also possible to store complete models with textures and animations. To unify the structure within a prefab, all components are grouped within a parent TGorillaGroup component inside the prefab file. Therefore you need to create a corresponding TGorillaGroup component to load data into.


Is a simple management component to prepare prefab loading. You can setup prefabs with their corresponding file location and load them on running the application.

var LList : TObjectList<TComponent>;
LList := TObjectList<TComponent>.Create(false);

Runtime Usage

When projects getting very large, prefabs need to be loaded at runtime. Take a look at the following function on how to do it.

  Gorilla.Prefab, Gorilla.Group, Gorilla.Model;
procedure TForm1.FormCreate(Sender: TObject);
var LPrefab : TGorillaPrefab;
    LGroup  : TGorillaGroup;
    LModel  : TGorillaModel;
  // create a group, because models inside the prefabs are stored within a group
  LGroup := TGorillaGroup.Create(GorillaViewport1);
  LGroup.Parent := GorillaViewport1;
  // load firemonkey from prefab file by creating a prefab in the prefab-system
  LPrefab := GorillaPrefabSystem1.AddPrefab('Firemonkey', LGroup,
  // then we load the prefab, which will generate a TGorillaModel instance for us
  // afterwards we try to find the instance
  LModel := LGroup.FindComponentDeepSearchByClass(TGorillaModel) as TGorillaModel;
  if not Assigned(LModel) then
  // at last rotate and scale the model to suit our view
  LModel.RotationAngle.X := 180;
  LModel.WrapMode := TMeshWrapMode.Fit;
  LModel.Scale.Point := Point3D(5, 5, 5);
  // check if animations are available
  if not (LModel.AnimationManager.Animations.Count > 0) then
  // execute the animation found

Assets Store (Beta)

During development process prefabs became very handy and useful. Like in other 3D DevTools (Unity, Unreal, …) it is common to share those over a platform.

We present to you!

In our assets store you can download prefabs and integrate them in your application. On downloading a prefab you will receive a *.prefab or a *.prefabz file. Both types can be integrated in the TGorillaPrefabSystem. Have a look at the code snippets above.

WARNING: Please take care of licensing restrictions before publishing them.

WARNING: The assets store is still in beta mode! Errors may occur!

Embedded AssetsStore (Beta)

Since we integrated the assets store also directly in the Delphi IDE.

  1. Drop a TGorillaPrefabSystem component onto your form.
  2. Right-Click on the component in the object inspector
  3. Click “AssetsStore” to open the embedded formular
  4. Browse through the assets and click to directly embed them in your form

WARNING: Please take care of licensing restrictions before publishing them.

WARNING: Some prefabs are very large in size or produce large output due to textures or animations. This can exceed your memory in IDE very fast!

WARNING: The assets store is still in beta mode! Errors may occur!

Next step: Android