Skip to content

Commit 085554c

Browse files
authored
Update custom objects doc
1 parent 9744fd5 commit 085554c

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs/gdevelop5/objects/custom-objects-prefab-template.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,38 @@ title: Custom Objects ("prefabs")
33
---
44
# Custom Objects ("prefabs")
55

6-
**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.
77

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
99

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.
1111

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.
1313

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.
1718

18-
!!! warning
19+
!!! note
1920

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.
2122

22-
## Create a new custom object
23+
The objects contained inside a custom object are called "children" or "child objects".
2324

24-
Make sure you've activated the feature in the preferences of GDevelop.
25+
## Create a new custom object
2526

2627
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).
2728

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"**.
2930

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:
3138

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

Comments
 (0)