Choose your operating system:
Windows
macOS
Linux
In order to understand and use the content on this page, make sure you are familiar with the following topics:
Before continuing with this guide:
-
Install the latest updates for Visual Studio 2017.
-
Download and install the Learning Resources UE4Snippets Visual Studio extension.
-
Download and extract this Example Snippet Project .
To improve Unreal Engine's API reference, we add Code Snippets, which are small chunks of sample code that demonstrate how to use the C++ API for Unreal Engine projects. If you would like to contribute code snippets to the
Unreal Engine API Reference
, follow this specification.
General Standards
-
Code snippets must follow the Coding Standard .
-
Comments should comply with the Coding Standard.
-
Code snippets should be thoroughly commented.
-
When appropriate, code snippets may be self-documenting.
-
Code snippets should be brief, and no longer than twenty-five lines deep.
-
Minimize line lengths so that readers do not have to rely on line wraps or scroll bars.
-
Submit zipped projects containing snippet code on GitHub to EpicGames/Unreal Engine .
Functions
-
There should be one code snippet for any given function.
-
Functions must produce meaningful output that is visible to the user.
-
Do not obfuscate a function's meaning with expressions that are difficult to interpret.
-
Demonstrate functions as clearly as possible, favoring reasonable and simple use cases.
Expressions and Statements
-
Do not sacrifice an expression's readibility for optimized performance.
-
Expressions and statements should be meaningful, clear, and transparent.
-
Conditional expressions should mimic the logic's natural language expression.
Snippet Blocks
-
Do not place two consecutive blank lines between any two lines of text in a snippet block.
-
Place
///CODE_SNIPPET_START:<class1::func1><classN::funcN>
above the code snippet.
-
Place
///CODE_SNIPPET_END
below the code snippet.
Quality Assurance
-
Tag code snippet submissions with
#UE4Docs
.
-
All code snippets will be code reviewed before being published.
-
After a code snippet has been published, its content should be maintained for clarity and correctness.