Skip to content

Commit 636497f

Browse files
author
Roberto De Ioris
committed
fixed unreal <4.14 support
1 parent 971ef17 commit 636497f

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Source/UnrealEnginePython/Private/UEPyPlayer.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,18 @@ PyObject *py_ue_get_num_players(ue_PyUObject *self, PyObject * args) {
5858
UWorld *world = ue_get_uworld(self);
5959
if (!world)
6060
return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject");
61-
61+
#if ENGINE_MINOR_VERSION < 14
62+
AGameMode *game_mode = world->GetAuthGameMode();
63+
#else
6264
AGameModeBase *game_mode = world->GetAuthGameMode();
65+
#endif
6366
if (!game_mode)
6467
return PyErr_Format(PyExc_Exception, "unable to retrieve GameMode from world");
65-
68+
#if ENGINE_MINOR_VERSION < 14
69+
return PyLong_FromLong(game_mode->NumPlayers);
70+
#else
6671
return PyLong_FromLong(game_mode->GetNumPlayers());
72+
#endif
6773
}
6874

6975
PyObject *py_ue_get_num_spectators(ue_PyUObject *self, PyObject * args) {
@@ -73,11 +79,17 @@ PyObject *py_ue_get_num_spectators(ue_PyUObject *self, PyObject * args) {
7379
UWorld *world = ue_get_uworld(self);
7480
if (!world)
7581
return PyErr_Format(PyExc_Exception, "unable to retrieve UWorld from uobject");
76-
82+
#if ENGINE_MINOR_VERSION < 14
83+
AGameMode *game_mode = world->GetAuthGameMode();
84+
#else
7785
AGameModeBase *game_mode = world->GetAuthGameMode();
86+
#endif
7887
if (!game_mode)
7988
return PyErr_Format(PyExc_Exception, "unable to retrieve GameMode from world");
80-
89+
#if ENGINE_MINOR_VERSION < 14
90+
return PyLong_FromLong(game_mode->NumSpectators);
91+
#else
8192
return PyLong_FromLong(game_mode->GetNumSpectators());
93+
#endif
8294
}
8395

Source/UnrealEnginePython/Public/PythonComponent.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ UPythonComponent::UPythonComponent()
77
{
88
// Set this component to be initialized when the game starts, and to be ticked every frame. You can turn these features
99
// off to improve performance if you don't need them.
10+
#if ENGINE_MINOR_VERSION < 14
11+
bWantsBeginPlay = true;
12+
#endif
1013
PrimaryComponentTick.bCanEverTick = true;
1114

1215
PythonTickForceDisabled = false;

0 commit comments

Comments
 (0)