Compile unreal from source - Linux
Follow this documentation to compile unreal from source: https://docs.unrealengine.com/4.27/en-US/SharingAndReleasing/Linux/BeginnerLinuxDeveloper/SettingUpAnUnrealWorkflow/
Generate project files command line
To generate project files you have to execute the following command:
sh ./GenerateProjectFiles.sh /path/to/workspace/PROJECT/PROJECT.uproject -game -engine -vscode
NOTE:
-vscode
is used to generate VSCode workspace.
NOTE: Follow this guide to properly setup VSCode: https://docs.unrealengine.com/5.0/en-US/setting-up-visual-studio-code-for-unreal-engine/
Unreal versioning of Binaries
How do I change version of compiled unreal engine?
It is possible to force your Build ID to a specific value. You can accomplish this by adding a BuildId
entry (as a string variable) to your Engine/Build/Build.version
JSON file, but it is not recommended, as it removes the check to prevent using incompatible Modules. It is particularly easy to run outdated code if using a forced Build ID with Plugins that may be shared between multiple Projects. SOURCE: https://docs.unrealengine.com/4.27/en-US/ProductionPipelines/BuildTools/UnrealBuildTool/VersioningofBinaries/
For some reason the above doesn't work. What you have to do is:
- Execute
./Setup.sh
- Navigate to
.config/Epic/UnrealEngine/Install.ini
- Remove any line but the header, the file should look exactly like this:
[Installations]
- Create a new directory and file:
.config/Epic/UnrealEngine/LauncherInstalled.dat
- Add the following data:
{
"InstallationList": [
{
"AppName": "UE_5.1",
"InstallLocation": "/path/to/UnrealEngine"
}
]
}
- Done, enjoy your engine version.
Note: The source of this info is UE discord Linux channel.
Best Windwows toolchain version
You can check the best toolchain version for Urneal engine here: UnrealEngine/Engine/Config/Windows /Windows_SDK.json
Rename classes, modules without breaking Blueprint
After a class or module rename you have to add a Core Redirect to make sure the BPs will continue working. Follow the doc here: https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/CoreRedirects/
Note 1: The
MatchSubstring=true
doesn't work so it's needed to use the full path+EnumRedirects=(OldName="/Script/StrayBalls.EFlTeam", NewName="/Script/MGame.EFlTeam") +ClassRedirects=(OldName="/Script/StrayBalls.FlHolographicObjectManager", NewName="/Script/MGame.FlHolographicObjectManager") +StructRedirects=(OldName="/Script/StrayBalls.FlMeshMaterials", NewName="/Script/MGame.FlMeshMaterials")
Note 2: Make sure to put the redirects under
[CoreRedirects]
insideDefaultEngine.ini
Note 3: Once the CoreRedirects works, you can re-compile and re-save all the BPs / Assets to make sure those use the new calss. Afterward you can remove the CoreRedirects.
To perform the above action you can use the UE4 commandlet
./UE4Editor /path/to/workspace/PROJECT/PROJECT.uproject -run=resavepackages OR ./UE4Editor /path/to/workspace/PROJECT/PROJECT.uproject -run=resavepackages -fixupredirectors
Event to detect when a controller is connected or disconnected
IPlatformInputDeviceMapper::GetOnInputDeviceConnectionChange()
Unreal Engine UObject pointers types
// Can be considered as a raw pointer.
TObjectPtr<UInputAction> MoveAction;
// Store a reference of an object that may be already garbage collected (owns it)
TSoftObjectPtr<UInputAction> MoveAction;
// Stores a non-owning reference to the object (acting like a weak smart ptr)
TWeakObjectPtr<UInputAction> MoveAction;
// Store a reference of an object and owns it, preventing to garbage collect.
TStrongObjectPtr<UInputAction> MoveAction;