If a variable doesn’t need to be stored anywhere, and you are not checking it over multiple frames, there isn’t much point to keep it as a member var, just a local var would be fine.
Event Dispatchers explained – Finally!
DNADrone, a user from Unreal Community posted an awesome explanation of what Event Dispatchers are. Check it outĀ here.
The Order Of C++ Inline Initialization (New In C++11), Initialization List, And Initialize In Constructor
Talk is cheap. Play with the code below to understand the order of inline initialization, initialization list and initialize in the class constructor.
#include <iostream> using namespace std; class Base { public: int Id = 0; // 1st int Id2 = Id + 1; // 2nd Base () : Id2 (Id - 1), Id (1) // 4th, 3rd An warnning about different orders in declarations and the init list { Id++; // 5th } void SayId () { cout << "My Id is " << Id << " Id2 is " << Id2 << endl; } }; // Type of Inheritance https://www.tutorialspoint.com/cplusplus/cpp_inheritance.htm class Derived : public Base // The public is called access-specifier, if it's not used, it's private by default. { public: Derived ()/* : Id2 (99)*/ // Can't init Id2 in here because it's not a member in class Derived { Id = 3; // 6th } }; int main(void) { Base Object; Derived DerivedObject; Object.SayId(); // Id 2 Id2 0 DerivedObject.SayId(); // Id 3 Id2 0 return 0; }
My Portfolio
Contributed to Unreal Engine 4.18
https://docs.unrealengine.com/latest/INT/Support/Builds/ReleaseNotes/4_18/index.html
Public reposĀ on Github
[huge_it_portfolio id=”4″]
Unreal Engine 4.15.3 Profiler Tool (Session Frontend)
Unreal Engine has provided a tool called Session Frontend which can show statistics about memory and time cost. Itās very useful when we want to check if our changes are helpful or not.
We can find this tool by clicking Window->Developer Tools.
There are several steps to profile a game using the profiler tool.
1) Select a sessionĀ which we want to profile from the Session Browser.
We can select a session by left-clicking it. If it doesnāt work, I suggest click the This Application part first to hide and show the session options and left-click it again.
2) Run the game in editor.
3) Press the Data Capture button to start collecting data from the gameĀ Or you can type Stat StartFile in the game console which can be opened by button Ā¬ (on the left hand of button number 1).
4) Press the Data Capture button again to stopĀ Or you can typeĀ Stat StopFile in the game console. If we use the console command we will be able to create a .ue4stats file inside theĀ ProjectNameSavedProfilingUnrealStats folder which we can load by pressing the Load button in the Session Frontend tool. It should work the same way as we use the DataCapture button.Ā
5) Click the Yes button in the pop-up window to transfer the stats file to the machine.
6) Press the Load file button.
If it goes well, we should be able to see the stats in the window. We are interested in the stats in the Navigation category. We can toggle the stats by clicking their names.
Disable the Start/Stop Sound When Playing in Editor UE 4.15 å ³éåØē¼č¾åØč·ęøøęå¼å§åē»ęēå£°é³ Unreal Engine 4.15
Edit->Editor Preferences->Miscellaneous->Enable Editor Sounds, uncheck this checkbox, there is no sound when hitting the Play or Stop button in editor anymore : ).
åę¶ęčæäøŖé锹ļ¼å°±äøä¼åęē¦äŗŗē声é³å½åØē¼č¾åØéč·ęøøęäŗć
C++ ē Rule of Three/Five/Zero
ęčæåØēØ C++ ēę¶åéå°äŗå ååŖå¢å äøéę¾ēé®é¢ļ¼ęēęÆå åę³ę¼ļ¼åę„åē°ę²”ęćęäŗęÆåƹ C++ ēå åč§åååäŗäøäŗęē“¢ļ¼ē°åØęē»č®ŗåäŗ«äøäøļ¼å¦ęęéåøę大家č½ęåŗļ¼ęęæäøå°½ć
ę们é½ē„éåØå heap äøåé ēå åęÆč¦ē±ēØåŗåčŖå·±éę¾ēļ¼éåøøę åµäøčæę²”ęä»ä¹é®é¢ļ¼ä½ęÆå¦ęę们ęäøäøŖ vector åę¾ object ēęéćčæäøŖ vector åęÆäøäøŖ class ē attribute ę åµå°±åå¾å¤ęäŗćčæē§ę åµäøļ¼å½ class č¢«ęę destruct ēę¶åļ¼vector ä¼éę¾ęå ¶äøęéå ēØēå åļ¼ä½ęÆäøä¼éę¾ęéęåēåÆ¹č±”ęå å åļ¼ę¤ę¶ļ¼å°±ä¼ęå åę³ę¼åēć
ę仄čæē§ę åµäøę们éč¦ē»čæäøŖ class 声ęäøäøŖčŖå®ä¹ēęęå½ę°ļ¼åØå ¶äømannually éę¾ęęÆäøŖęéęååÆ¹č±”ęå å åćC++ éęäøŖ Rule of Three čÆ“ēå°±ęÆå¦ęä½ å®ä¹äŗęęå½ę°(å¦äøęčæ°ę åµ)ļ¼é£ä¹ä½ åŗčÆ„čæéč¦čŖå®ä¹ę·č“ęé å½ę°åčµå¼čæē®ē¬¦ć
å¦äøäøŖę“儽ēę¹ę³ęÆä½æēØ smart pointer, ę们就äøéč¦čŖå®ä¹ęęå½ę°ę„éę¾ęéęåēåÆ¹č±”äŗć
čæéåčÆ“äøē¹å°±ęÆå·® C++ ēäøč„æęäøč¬äø cppreference.com ęÆč¾ęåØ
Fatal Error C1083: Cannot open include file: 'xxx.generated.h': No such file or directory Unreal Engine 4 Plugins
I am trying to develop a game plugin for Unreal Engine 4.15. I’d like to do something with the FoliageType, so I include the FoliageType.h like this
#include "FoliageType.h"
(Unreal Engine has its own rule to include all .h file from the Public folders so if the .h file is inside a Public folder, you can just write #include “xxx.h”, no more relative or absolute path is needed.)
Then, I compile my project, I get the error “fatal error C1083: Cannot open include file: ‘FoliageType.generated.h’: No such file or directory”.
The way to solve this error is adding “Foliage” to the PublicDependencyModuleNames in the PluginName.Build.cs file and regenerate your Visual Studio project files (right click the uprojectĀ file to open this. In this case this the generating project step isn’t necessary. The way I understand this generating project step is it updates the solution files tree in Visual Studio or any other IDEs, so if you put some new source files in the project but you can’t see them in Visual Studio, this generating process will solve it. Another usage of this process is it creates the xxx.generated.h files.).
My guess is because I’ve included the FoliageType.h, my plugin is dependent on the Foliage Module so I have to add it.
How To Create A Game Plugin In Unreal Engine 4.15 From Scratch
I am working on adding a plugin for a game project in Unreal Engine 4.15. I have done some searches about this topic and I almost couldn’t find anything up-to-date.
So, I decide to write one myself and hope it helps.
BTW, there are two types of plugins in Unreal Engine 4, engine plugins which are in the Engine/Plugins folder and game plugins which are in the game project folder. There is no Plugins folder under the game project folder by default, so if you are creating the first plugin for a game project, you need to create a folder named Plugins and regenerate the game project file (right click the GameProjectName.uproject and choose Generate Visual Studio project files).
1. To copy and paste one of the sample plugins(BlankPlugin) from the Unreal Engine plugins folder(Engine/Plugins/Developer) to your project Plugins folder(create one inside your project folder if you don’t have one), and rename the sample plugin to the name of your plugin. You will need to go through and rename the files, class names and plugin names throughout so that it does not conflict with the existing plugins.
1) Don’t forget to add IncludePaths and DependencyModuleNames in the PluginName.Build.cs file. (My understanding about the IncludePaths is where the compiler should go to get the include files and DependencyModules are modules should be linked by the linker. Here is a good answer about what is the difference between the public/private dependency modules) One problem about this step is most times you don’t know which module should be used, the way I use is looking at other plugins and see what they have. Another way is by guessing, you can take a look at the folder name and try to it as a DependencyModuleName. I am not sure if there is a better way to handle this or there is a doc talking about this. If so, please leave a comment and let me know.
{ public PluginName(TargetInfo Target) { PublicDependencyModuleNames.AddRange( new string[] { // ... add other public dependencies that you statically link with here ... "Core", "CoreUObject", "Engine", } ); PrivateDependencyModuleNames.AddRange( new string[] { // ... add private dependencies that you statically link with here ... "Slate", "SlateCore", "InputCore", // Missing this may cause fatal error LNK1120: xxx unresolved externals if you use Input related Slates like SButton STextBlock "WorkspaceMenuStructure", // For #include "WorkspaceMenuStructure.h" and #include "WorkspaceMenuStructureModule.h" "Projects", // For the implementation of IPluginManager } ); PrivateIncludePaths.AddRange(new string[] { "PluginName/Private" }); PublicIncludePaths.AddRange(new string[] { "PluginName/Public" }); } }
2. regenerate your project files so you can see the latest files of your project inside the Solution Explorer Window of visual studio.
1) Right click ProjectName.uproject
2) Select Generate Visual Studio project files
Here is a ppt talking about how to create plugins in UE4.Ā UE4Creatingplug-ins
Github Is Not Always Connectable
When you are trying to connect to the github.com and a TIME OUT happens. You may see a fatal error log looks like this
https://github.com/xxx/xxx.git/': Failed to connect to github.com port 443: Timed out
Either because you are blocked. So, you need a proxy to connect to github.com which has been talked a lot on stackoverflow.
Or there is a problem on the github end. You can see the status of github.com through this website.