You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Custom objects** are reusable objects containing custom logic and one or more other objects. "Custom objects" are also called **"Prefabs"** or "Templates" in some game engines.
6
+
**Custom objects** are containers, composed of one or more other objects and having custom logic (made with events, like in a traditional scene) inside them.
7
7
8
-
They allow to speed-up development and make games more modular by having an object that can be reused and customized in different scenes.
8
+
!!! tip
9
9
10
-
For example, the **[multitouch joysticks](/gdevelop5/objects/multitouch-joystick), [buttons](/gdevelop5/objects/button), [sliders](/gdevelop5/objects/slider)** and other user interface objects that you can find in the list of objects are “custom objects” built with other objects.
10
+
"Custom objects" are also called **"Prefabs"** or "Templates" in some game engines.
11
11
12
-
Custom objects contain other objects, which are called "child objects". They can display on screen one or more instances of these "child objects" and can offer:
12
+
They allow to speed-up development and make games more modular by having an object that can be reused in different scenes.
13
13
14
-
* custom conditions,
15
-
* custom actions,
16
-
* custom expressions.
14
+
For example, you can build:
15
+
- A custom object that is a **dialog**, composed of a background, some text, some buttons. This allows to do all the logic related to this dialog inside the custom object events, without cluttering the scene events.
16
+
The scene can check which buttons were clicked using custom condition(s) added on the custom object (these conditions can access the buttons inside the custom object to check if they are clicked).
17
+
- A character or some other game objects that is composed of multiple parts. For example, a player with a moving arm.
17
18
18
-
!!! warning
19
+
!!! note
19
20
20
-
This feature is a work-in-progress. You must activate it in the preferences of GDevelop and the user experience for creating a custom object from scratch is rough.
21
+
The **[multitouch joysticks](/gdevelop5/objects/multitouch-joystick), [buttons](/gdevelop5/objects/button), [sliders](/gdevelop5/objects/slider)** and other user interface objects that you can find in the list of objects are “custom objects” built with other objects.
21
22
22
-
## Create a new custom object
23
+
The objects contained inside a custom object are called "children" or "child objects".
23
24
24
-
Make sure you've activated the feature in the preferences of GDevelop.
25
+
## Create a new custom object
25
26
26
27
Custom objects are grouped into "extensions". They are composed of functions, behaviors or custom objects powered by events. You can see the list of all the extensions the game has in the [Project Manager](/gdevelop5/interface/project-manager).
27
28
28
-
Extensions that are installed by the asset store are using events. They can be modified the same way as any extensions. This allows to make some changes to the way the objects work to better fit a game. Make sure to back up your changes or rename the extension to avoid overriding them later by updating the extension.
29
+
To create a new custom object, the easiest way is to add a few objects on the scene, then put an instance of each on the scene editor. Select then these instances, right click/long touch the selection and choose "Extract" > **"Extract as a custom object"**.
29
30
30
-
!!! tip
31
+
Choose an extension name, custom object name and validate. This will open a new editor containing the objects you've selected along with the instances from the scene. In the scene, the instances you've selected are replaced by a unique custom object, that acts as a container for all of them.
32
+
33
+
!!! note
34
+
35
+
At the moment, you can't mix 2D and 3D objects in a custom object.
36
+
37
+
If you started creating events using these objects, you must rework them. Indeed, the objects are now hidden inside the new custom object (they are called "children"). In most cases, you want to add 2 type of "functions" to your custom object:
31
38
32
-
As we write this documentation, please reach out on the forum or the help channel on Discord if you struggle to use them or have feedback.
39
+
- A **doStepPostEvents** function that are events launched at every frame - much like scene events. They can do logic on the child objects. For example, it could rotate them, animate them or something else.
40
+
- One or more **action** or **condition**. If your scene wants to manipulate a child, or use a condition on it, it's a good sign that you need to "expose" this through a custom **action** or **condition**.
0 commit comments