Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Unreal Engine 4 Scripting with C++ Cookbook
Credits
About the Authors
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Sections
Getting ready
How to do it…
How it works…
There's more…
See also
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. UE4 Development Tools
Introduction
Installing Visual Studio
Getting ready
How to do it...
How it works...
Creating and building your first C++ project in Visual Studio
Getting ready
How to do it...
How it works...
There's more...
Changing the code font and color in Visual Studio
Getting ready
How to do it...
How it works...
There's more...
See also
Extension – changing the color theme in Visual Studio
How to do it...
How it works...
Formatting your code (Autocomplete settings) in Visual Studio
Getting ready
How to do it...
How it works...
Shortcut keys in Visual Studio
Getting ready
How to do it...
How it works...
Extended mouse usage in Visual Studio
How to do it...
How it works...
UE4 – installation
Getting ready
How to do it...
How it works...
There's more...
UE4 – first project
How to do it...
UE4 – creating your first level
Getting ready
How to do it…
UE4 – logging with UE_LOG
Getting ready
How to do it...
How it works...
UE4 – making an FString from FStrings and other variables
Getting ready
How to do it…
Project management on GitHub – getting your Source Control
Getting ready
How to do it...
How it works...
Project management on GitHub – using the Issue Tracker
Getting ready
How to do it...
How it works...
See also
Project management on VisualStudio.com – managing the tasks in your project
How to do it...
How it works…
Project management on VisualStudio.com – constructing user stories and tasks
Getting ready
How to do it…
How it works…
2. Creating Classes
Introduction
Making a UCLASS – deriving from UObject
Getting ready
How to do it...
How it works…
There's more…
See also
Creating a user-editable UPROPERTY
Getting ready
How to do it...
How it works…
See also
Accessing a UPROPERTY from Blueprints
How to do it...
How it works…
Specifying a UCLASS as the type of a UPROPERTY
Getting ready
How to do it...
How it works…
TSubclassOf
FStringClassReference
Creating a Blueprint from your custom UCLASS
Getting ready
How to do it…
How it works…
Instantiating UObject-derived classes (ConstructObject < > and NewObject < >)
Getting ready
How to do it...
How it works…
There's more…
Destroying UObject-derived classes
Getting ready
How to do it...
How it works…
Creating a USTRUCT
Getting ready
How to do it...
How it works...
There's more…
Creating a UENUM( )
How to do it...
How it works…
Creating a UFUNCTION
How to do it...
How it works…
3. Memory Management and Smart Pointers
Introduction
Unmanaged memory – using malloc( )/free( )
How to do it...
How it works…
Unmanaged memory – using new/delete
Getting ready
How to do it...
How it works…
There's more…
Managed memory – using NewObject< > and ConstructObject< >
Getting ready
How to do it...
How it works…
There's more…
See also
Managed memory – deallocating memory
Getting ready
How to do it...
How it works…
There's more…
Managed memory – smart pointers (TSharedPtr, TWeakPtr, TAutoPtr) to track an object
Getting ready
How to do it...
How it works…
There's more…
Using TScopedPointer to track an object
Getting ready
How to do it...
How it works…
Unreal's garbage collection system and UPROPERTY( )
How to do it...
How it works…
Forcing garbage collection
Getting ready
How to do it...
Breakpoints and stepping through code
Getting ready
How to do it...
How it works…
Finding bugs and using call stacks
Getting ready
How to do it...
How it works…
Using the Profiler to identify hot spots
How to do it...
How it works…
4. Actors and Components
Introduction
Creating a custom Actor in C++
Getting ready
How to do it...
How it works...
Instantiating an Actor using SpawnActor
How to do it...
How it works...
Destroying an Actor using Destroy and a Timer
How to do it...
How it works...
Destroying an Actor after a delay using SetLifeSpan
How to do it...
How it works...
Implementing the Actor functionality by composition
Getting ready
How to do it...
How it works...
See also
Loading assets into components using FObjectFinder
Getting ready
How to do it...
How it works...
Implementing the Actor functionality by inheritance
How to do it...
How it works...
See also
Attaching components to create a hierarchy
How to do it...
How it works...
Creating a custom Actor Component
How to do it...
How it works...
Creating a custom Scene Component
How to do it...
How it works...
See also
Creating a custom Primitive Component
How to do it...
How it works...
Creating an InventoryComponent for an RPG
Getting ready
How to do it...
How it works...
See also
Creating an OrbitingMovement Component
How to do it...
How it works...
Creating a building that spawns units
How to do it...
How it works...
5. Handling Events and Delegates
Handling events implemented via virtual functions
How to do it...
How it works...
Creating a delegate that is bound to a UFUNCTION
Getting ready
How to do it...
How it works...
See also
Unregistering a delegate
Getting ready
How to do it...
How it works...
Creating a delegate that takes input parameters
Getting ready
How to do it...
How it works...
See also
Passing payload data with a delegate binding
Getting ready
How to do it...
How it works...
See also
Creating a multicast delegate
Getting ready
How to do it...
How it works...
Creating a custom Event
Getting ready
How to do it...
How it works...
Creating a Time of Day handler
How to do it...
How it works...
Creating a respawning pickup for an First Person Shooter
How to do it...
How it works...
6. Input and Collision
Introduction
Axis Mappings – keyboard, mouse and gamepad directional input for an FPS character
Getting ready
How to do it...
How it works…
See also
Axis Mappings – normalized input
Getting ready
How to do it…
How it works...
Action Mappings – one button responses for an FPS character
Getting ready
How to do it...
How it works…
See also
Adding Axis and Action Mappings from C++
Getting ready
How to do it...
How it works…
Mouse UI input handling
Getting ready
How to do it...
How it works…
UMG keyboard UI shortcut keys
Getting ready
How to do it...
How it works…
Collision – letting objects pass through one another using Ignore
Getting ready
How to do it...
How it works…
Collision – picking up objects using Overlap
Getting ready
How to do it...
How it works…
Collision – preventing interpenetration using Block
Getting ready
How to do it...
How it works…
There's more…
7. Communication between Classes and Interfaces
Introduction
Creating a UInterface
How to do it...
How it works...
See also
Implementing a UInterface on an object
How to do it...
How it works...
Checking if a class implements a UInterface
How to do it...
How it works...
See also
Casting to a UInterface implemented in native code
Getting ready
How to do it...
How it works...
Calling native UInterface functions from C++
How to do it...
How it works...
See also
Inheriting UInterface from one another
How to do it...
How it works...
Overriding UInterface functions in C++
Getting ready
How to do it...
How it works...
See also
Exposing UInterface methods to Blueprint from a native base class
How to do it...
How it works...
See also
Implementing UInterface functions in Blueprint
How to do it...
How it works...
See also
Creating C++ UInterface function implementations that can be overridden in Blueprint
How to do it...
How it works...
Calling Blueprint-defined interface functions from C++
How to do it...
How it works...
Implementing a simple interaction system with UInterfaces
How to do it...
How it works...
8. Integrating C++ and the Unreal Editor
Introduction
Using a class or struct as a blueprint variable
How to do it…
How it works…
There's more…
Creating classes or structs that can be subclassed in Blueprint
How to do it…
How it works…
Creating functions that can be called in Blueprint
How to do it…
How it works…
See also
Creating events that can be implemented in Blueprint
How to do it…
How it works…
Exposing multi-cast delegates to Blueprint
How to do it…
How it works…
See also
Creating C++ enums that can be used in Blueprint
How to do it…
How it works…
Editing class properties in different places in the editor
How to do it…
How it works…
See also
Making properties accessible in the Blueprint editor graph
How to do it…
How it works…
Responding to property – changed events from the editor
How to do it…
How it works…
Implementing a native code Construction Script
How to do it…
How it works…
Creating a new editor module
How to do it…
How it works…
Creating new toolbar buttons
How to do it…
How it works…
Creating new menu entries
How to do it…
How it works…
Creating a new editor window
How to do it…
How it works…
See also
Creating a new Asset type
How to do it…
How it works…
See also
Creating custom context menu entries for Assets
How to do it…
How it works…
Creating new console commands
Getting ready
How to do it...
How it works...
See also
Creating a new graph pin visualizer for Blueprint
How to do it...
How it works...
Inspecting types with custom Details panels
How to do it...
How it works...
9. User Interfaces – UI and UMG
Introduction
Drawing using Canvas
How to do it...
How it works...
Adding Slate Widgets to the screen
Getting ready
How to do it...
How it works...
Creating screen size-aware scaling for the UI
Getting ready
How to do it...
The In-Editor method
The Config file method
How it works...
See also
Displaying and hiding a sheet of UMG elements in-game
How to do it...
How it works...
Attaching function calls to Slate events
Getting ready
How to do it...
How it works...
Use Data Binding with Unreal Motion Graphics
How to do it...
How it works...
Controlling widget appearance with Styles
How to do it...
How it works...
Create a custom SWidget/UWidget
Getting ready
How to do it...
How it works...
10. AI for Controlling NPCs
Introduction
Laying down a Navigation Mesh
Getting ready
How to do it...
How it works…
Following behavior
Getting ready
How to do it…
How it works…
There's more…
Connecting a Behavior Tree to a Character
Getting ready
How to do it...
How it works…
Constructing Task nodes
Getting ready
How to do it…
Using Decorators for conditions
Getting ready
How to do it…
How it works…
Using periodic services
Getting ready
How to do it…
How it works…
Using Composite nodes – Selectors, Sequences, and Simple Parallel
Getting ready
How to do it…
AI for a Melee Attacker
Getting ready
How to do it...
11. Custom Materials and Shaders
Introduction
Modifying color using a basic Material
Getting ready
How to do it...
Modifying position using a Material
Getting ready
How to do it...
Shader code via Custom node
Getting ready
How to do it...
How it works…
The Material function
Getting ready
How to do it...
How it works…
There's more…
Shader parameters and Material instances
Getting ready
How to do it...
How it works…
Glimmer
Getting ready
How to do it...
How it works…
Leaves and Wind
Getting ready
How to do it...
How it works…
Reflectance dependent on the viewing angle
Getting ready
How to do it...
How it works…
Randomness – Perlin noise
Getting ready
How to do it...
How it works…
Shading a Landscape
Getting ready
How to do it...
How it works…
12. Working with UE4 APIs
Introduction
Core/Logging API – Defining a custom log category
Getting ready
How to do it…
How it works…
There's more…
See also
Core/Logging API – FMessageLog to write messages to the Message Log
Getting ready
How to do it…
Core/Math API – Rotation using FRotator
Getting ready
How to do it…
Core/Math API – Rotation using FQuat
Getting ready
How to do it…
How it works…
There's more…
Core/Math API – Rotation using FRotationMatrix to have one object face another
Getting ready
How to do it…
How it works…
Landscape API – Landscape generation with Perlin noise
Getting ready
How to do it…
How it works…
There's more…
Foliage API – Adding trees procedurally to your level
Getting ready
How to do it…
Manually
Procedurally
See also
Landscape and Foliage API – Map generation using Landscape and Foliage APIs
Getting ready
How to do it…
How it works…
There's more…
GameplayAbilities API – Triggering an actor's gameplay abilities with game controls
Getting ready
How to do it…
How it works…
There's more…
See also
GameplayAbilities API – Implementing stats with UAttributeSet
Getting ready
How to do it…
How it works…
There's more…
GameplayAbilities API – Implementing buffs with GameplayEffect
Getting ready
How to do it…
How it works…
There's more…
GameplayTags API – Attaching GameplayTags to an Actor
How to do it…
GameplayTasks API – Making things happen with GameplayTasks
Getting ready
How to do it…
How it works…
There's more…
HTTP API – Web request
Getting ready
How to do it…
How it works…
There's more…
HTTP API – Progress bars
Getting ready
How to do it…
How it works…
Index
← Prev
Back
Next →
← Prev
Back
Next →