# Setup editor consoleEdit->Editorsettings->KeyboardShortcuts->searchfor'console'->Setkeybindfor'Open console command box'(forexample'§')# Setup in game consoleEdit->Projectsettings->Input->Console->SetConsolekey(forexample'ยง')# Console settingsEdit->Projectsettings->Console
## Console commands:# Set fps to max 60t.maxFPS60# Show fpsstatFPS
# Show triangle countstatRHI
# Displays the amount of time in milliseconds used by the GPU for different processes. StatGPU
C++
# UPROPERTY-Step1:Determineblueprintaccessibility
-BlueprintReadWrite:Blueprintscanreadandwritethevariable
-BlueprintReadOnly:Blueprintscanonlyreadthevariable
-<nothing>:Canbeleftempty,newvariablesshouldalwayshaveatleastemptyUPROPERTY
-Step2:Determineeditoraccessibility
-EditAnywhere
-EditInstanceOnly
-EditDefaultsOnly
-VisibleAnywhere
-VisibleInstanceOnly
-VisibleDefaultsOnly
-<nothing>
-Step3:Determinecategory
-AddCategory="_name_here_"-parameter
-Step4:
-Meta=(AllowPrivateAccess="true"):fixcompilererrorsayingthat"VisibleAnywhere"can'tbeaprivatevariable
# UFUNCTION-Step1:Determineblueprintaccessibility
-BlueprintCallable:Usefornonconstfunctions
-BlueprintPure:Useforconstfunctions
-<nothing>:Canbeleftempty,newfunctionsshouldalwayshaveatleastemptyUFUNCTION
-Step2:Determineimplementationlocation
-BlueprintImplementableEvent:Canhavefunctionbodyonlyinblueprints
-BlueprintNativeEvent:Canhavefunctionbodybothinblueprintsandc++
-Step3:Determinecategory
-AddCategory="_name_here_"-parameter
# Note! If C++ -> Blueprint functions act weird; restart UE4 and re-parent the object by opening the blueprint, change parent in details panel to the main parent and then back to base parent# When creating a new project, start with a blueprint project. Can be changedlatertoC++project.
World partitioning/streaming
# Setup world streaming1.Worldsettings->World->EnableWorldComposition
2.Window->Levels->Levelsdropdown->Createnew->Emptylevel->Save->Selectandmmakecurrent
3.Modelslandscape->AdjustSectionSize/SectionsPerComponent/NumberofComponents->Create
4.InLevelsview,clickthe"Summons world composition"button
5.Movethelevelsquarenexttotheaxislines
6.Rightclickthelevel->AddadjacentLandscapelevel->X/Ylocations->Save
7.(Optionalifstreamingdistanceneedstobeadjusted)Inworldcompositiontool;clickthe'+'button->Giveanewnameandadjustthestreamingdistance
Editor
# Open GPU VisualizerPressCtrl+Shift+,
# Find items on the 3d view ( for example the player. )Modes->Select->Playerstart->PressFkey
# Move objectClickobject->PressW
# Rotate objectClockobject->PressE
# Scale objectClickobject->PressR
# Hide lines and stuff in the 3d viewerPressG
# Snap object to groundClickobject->PressEnd
# Material editor freezes the editor-Uninstallincredibuild
# Opening a project gets stuck at 39%-Justwait,itmighttakeawhile.
Camera
# Fix camera not moving up/downOpenCharacterblueprint(orcameraBPifseparate)In'details'panelsearchfor'Use Pawn Control Rotation'Checkthatbox
# Move faster in freelook modeHoldRightmousebuttondownandscrolluptospeedup,scrolldowntoslowdown,whilemovingwitharrowkeys
# Disable lens flare-PostProcessVolume->PostProcessVolumeSettings->enable'unbound'-PostProcessVolume->Lensflare->Intensity0
Character movement
# Make character move with keyboard keys and animate(Source:https://www.youtube.com/watch?v=DimZmTd5H44)-File->NewC++Class->Create'MainCharacterBase.cpp'-Createnewblueprinttotheproject->Rightclickcontentbrowser->Blueprintclass->
SearchforMainCharacterBase
-NametheblueprintasMainCharacter_BP
-EditMainCharacter_BP->Vuewport->SelectMesh->AddSkeletalmesh
-Addcomponent->Camera->RenametoMain_Camera
-AdjustCapsuleComponentandCamera
# Setup movement keys:Edit->ProjectSettings->Engine->Input->Bindings
ActionMappings:
-Jump
-SpaceBar
AxisMappings:
-Forward_Backward
-W:Scale1-S:Scale-1
-Left_Right:
-A:Scale-1
-D:Scale1-Rotate_Left_Right:
-MouseX:Scale1-Look_Up_Down
-MouseY:Scale-1
-Edit'MainCharacter_BP'->EventGraph:
InputAxisForward_Backward->AddMovementInput
InputAxisForward_Backward(Axisvalue)->AddMovementInput(Scalevalue)GetControlRotation->GetForwardVector->AddmovementInput(WorldDirection)InputAxisLeft_Right->AddMovementInput
InputAxisInputAxis(Axisvalue)->AddMovementInput(Scalevalue)GetControlRotation->GetRightVector->AddmovementInput(WorldDirection)InputAxisRotate_Left_Right->AddControllerYawInput
InputAxisRotate_Left_Right(Axisvalue)->AddControllerYawInput(Val)InputAxisLook_Up_Down->AddControllerPitchInput
InputAxisLook_Up_Down(Axisvalue)->AddControllerPitchInput(Val)InputActionJump(Pressed)->Jump(function)
# How to scale a texture-Openmaterial
-RightclicknexttoTextureSamplethatisneededtobescaledup/down
-SearchforTextureCoordinates->selectthatnode
-DragTextureCoordinatesnodetoTextureSampleUVssection
-ChangeUTilingandVTilingontheleftdetailspanel
# How to scale a material texture dynamically# Note: This has a drawback with animated/moving objects; in cases where the # object moves, it looks like the texture is 'swimming' on the surface, # because it's fixed to the world location and object is moving.# So in a nutshell; use only on static objects.-Openmaterial
-RightclicknexttoTextureSamplethatisneededtobescaledup/down
-Searchfor'World Aligned Texture'->selectthatnode
-Rightclicktextureandselect'Convert to texture object'-DragTextureobject's node to 'WorldAlignedTexture's''TextureObject (T2d)'section
-Drag'World Aligned Texture's' 'XYZTexture' output to Material's'Base Color'-RepeatthesesamestepsforNormalmaps,Ambientmaps,Roughnessmap's etc. Except change 'WorldAlignedTexture' to: - 'WorldAlignedNormal'- Create new node 'VectorParameter' -> Edit its configs and set texture RGB values to change scaling- Connect VectorParameter output to WorldAlignedTexture/Normal 'TextureSize(V3)'input
# Paint grass(Source:https://www.youtube.com/watch?v=CkAlenO9q1Q)-Gotoforexample/Game/Environmentfolder-Rightclickcontentbrowser->CreateMaterial->Openit-Searchfor'landscape'indetailspanel->Drag'LandscapeGrassOutput','LandscapeLayerBlend and'LandscapeLayerSample' to the editor view.- Click 'LayerBlend' and set 'LayerName' to 'Grass' in the left details panel and 'Preview..' -> 1- Select 'SampleNone' -> set parameter name 'Grass'- Drag landscape 'groundbase' texture from content browser to the editor view- Connect texture sample to 'LayerBlend' and then to main 'Grass' object 'BaseColor'- Connect 'SampleGrass' -> Grass node- Right click content browser -> Foliage -> Landscape Grass Type -> Open it- Add array -> Assign Grass Mesh -> Set Grass Density -> Save- Open Grass material -> Click the small Grass node -> Set 'Grasstype' parameter on the left- Click 'Apply'- World outliner -> Select landscape object -> Modes -> Landscape -> Paint -> Select landscape objectagain in the world outliner - On the left, select assign the Grass material to Target Layers -> Save- Paint tool -> Select target layers material -> Paint to screen-- To add more different types of grass, edit 'Grass1' Landscape type -> Add array -> Assign anothermaterial and set density# Remove gloss from ground on material, for example ground( Source: https://www.youtube.com/watch?v=oeD2xnlCUTY )- Open the material that needs to have glossiness removed- Drag away from 'Specular' section of the material- Search for 'Constant'- Leave value at 0- Save and apply# Place trees- Modes -> Foliage -> Drag some plant and tree meshes on the left- Adjust Size and density, for example 0.001 density for trees and 500 size- Start painting trees to the view# Add foliage collisionOpen foliage toolAdd some meshClick the mesh open and down in the settings set collision to for example 'blockAll'Savemesh(thediskiconinthetoprightcornerofthemeshinfoliagetool)Start painting
LOD
# Setup smooth transition between LODsFirstmodifythebasematerial(forexampleM_Bark),searchforditheredlod,enable"Dithered LOD1"Thenopentheobjectmaterial(forexampleMI_Bark)->Searchfor'dithered LODTransition'->Tickbothboxes