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
Copy file name to clipboardExpand all lines: manual/release-notes/1_4/index.md
+7
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,13 @@
10
10
11
11
We refactored actors' `PostLoad`/`PostSpawn` methods into `Initialize` and changed the script `OnAwake` event to be called during this initialization phase - before any `OnStart`/`OnEnable` logic. This helps to create gameplay systems in a scheme of manager+objects where the manager can use `OnAwake` to initialize properly, and `OnEnable` can be used to register objects to the manager. This change has no performance impact but might be important to address in existing Flax projects.
12
12
13
+
### Plugins scripting changes
14
+
15
+
For this update, we've added support for implementing Game Plugins in C++ scripts - previously it was C#-only feature. For this change, both `GamePlugin` and `EditorPlugin` has been slightly modified:
16
+
*`Description` getter is read-only and your plugin can fill `_description` field in the constructor to set up plugin info.
17
+
*`OnCollectAssets` has been renamed to `GetReferences` and returns the list of Guids with referenced assets.
18
+
We've updated docs and code examples to reflect those changes.
19
+
13
20
### Large Worlds
14
21
15
22
Adding 64-bit precision to the world coordinates to the Flax was a challenge. Both Engine and Editor have very complex and mature systems with tooling thus we wanted to make this transition seamless and stable. One of the goals was to don't bloat memory by just doubling every floating-point value but instead upgrade world-coordinates-related data to support very large worlds. For instance, 32-bit float gives us enough precision to represent object rotation and scale thus we upgraded only `Translation` (aka `Position`) of the `Transform` to a 64-bit double vector. Also, the UI system, mesh data, textures converter, and other engine features were changed to keep explicitly *Float* vectors for performance reasons.
Copy file name to clipboardExpand all lines: manual/scripting/plugins/index.md
+58-10
Original file line number
Diff line number
Diff line change
@@ -60,17 +60,21 @@ There are two types of plugins:
60
60
61
61
**Game Plugins** are type of plugin that can be used at runtime. Game plugins are deployed with the game and can extend the engine by adding new features. Plugins can contain custom scripts that can be used in a game. To create a simple game plugin use the following code example:
Description="This is my custom plugin made for Flax.",
72
-
Author="Someone Inc.",
73
-
};
69
+
// Initialize plugin description
70
+
_description=newPluginDescription
71
+
{
72
+
Name="My Plugin",
73
+
Category="Other",
74
+
Description="This is my custom plugin made for Flax.",
75
+
Author="Someone Inc.",
76
+
};
77
+
}
74
78
75
79
/// <inheritdoc />
76
80
publicoverridevoidInitialize()
@@ -89,6 +93,47 @@ public class MyPlugin : GamePlugin
89
93
}
90
94
}
91
95
```
96
+
# [C++](#tab/code-cpp)
97
+
```cpp
98
+
// .h
99
+
#pragma once
100
+
101
+
#include"Engine/Scripting/Plugins/GamePlugin.h"
102
+
103
+
API_CLASS() class GAME_API MyPlugin : public GamePlugin
104
+
{
105
+
DECLARE_SCRIPTING_TYPE(MyPlugin);
106
+
107
+
void Initialize() override;
108
+
void Deinitialize() override;
109
+
};
110
+
111
+
// .cpp
112
+
#include"MyPlugin.h"
113
+
#include"Engine/Core/Log.h"
114
+
115
+
MyPlugin::MyPlugin(const SpawnParams& params)
116
+
: GamePlugin(params)
117
+
{
118
+
// Initialize plugin description
119
+
_description.Name = TEXT("My Plugin");
120
+
_description.Category = TEXT("Other");
121
+
_description.Description = TEXT("This is my custom plugin made for Flax.");
122
+
_description.Author = TEXT("Someone Inc.");
123
+
}
124
+
125
+
void MyPlugin::Initialize()
126
+
{
127
+
LOG(Info, "Plugin initialization!");
128
+
}
129
+
130
+
void MyPlugin::Deinitialize()
131
+
{
132
+
LOG(Info, "Plugin cleanup!");
133
+
}
134
+
135
+
```
136
+
***
92
137
93
138
Your game can also use a Game Plugins within a code to implement various gameplay features because plugins don't rely on loaded scenes or scene objects and are created before the scenes loading (compared to the normal scripts).
94
139
@@ -98,14 +143,14 @@ If you need to include custom settings for your plugin see [this tutorial](../tu
98
143
99
144
### Game Plugin Assets
100
145
101
-
If you want to bundle custom assets used in code-only plugin (eg. shader or debug model) override `OnCollectAssets` method as follows and provide IDs of the assets to include:
146
+
If you want to bundle custom assets used in code-only plugin (eg. shader or debug model) override `GetReferences` method as follows and provide IDs of the assets to include:
0 commit comments