Skip to content

Instantly share code, notes, and snippets.

View tmsampson's full-sized avatar
🕹️
Pushing Pixels

Thomas Sampson tmsampson

🕹️
Pushing Pixels
View GitHub Profile
View ue5_catch_asset_load
//----------------------------------------------------------------------------------------------------------
// Overview
//----------------------------------------------------------------------------------------------------------
// Below is a modified version of the vanilla UE5 function FLinkerLoad::CreateExportAndPreload which
// allows you to set a breakpoint which catches the loading of a specific asset (in this case "MyAsset").
//
// NOTE: Lines which have been added to the vanilla version of this method are tagged as "// << New"
//
// NOTE: Here we also force bForcePreload to true when encountering the asset, which causes the PreLoad
// function to be called immediately and synchronously (which is handy if you next want to debug
View preprocessor_definition_from_string.cs
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
// Overview
//----------------------------------------------------------------------------------------------------------
// GeneratePreProcessorDefinition takes an input string and returns a C++ style pre-processor definition
//----------------------------------------------------------------------------------------------------------
// Usage
//----------------------------------------------------------------------------------------------------------
// string PreProcessorDefinition = GeneratePreProcessorDefinition("Input String");
//----------------------------------------------------------------------------------------------------------
@tmsampson
tmsampson / ue4_networking_watch_window_helpers.txt
Created November 8, 2020 14:19
UE4 Networking Watch Window Helpers
View ue4_networking_watch_window_helpers.txt
/* --- IS THIS THE SERVER? ---> */ {,,"UE4Editor-Engine.dll"}((UEditorEngine*)GEngine)->PlayWorld!=0 && (({,,"UE4Editor-Engine.dll"}((UEditorEngine*)GEngine)->PlayWorld)->NetDriver)->ServerConnection==0
/* --- IS THIS THE CLIENT? ---> */ {,,"UE4Editor-Engine.dll"}((UEditorEngine*)GEngine)->PlayWorld!=0 && (({,,"UE4Editor-Engine.dll"}((UEditorEngine*)GEngine)->PlayWorld)->NetDriver)->ServerConnection!=0
View ue4_blueprint_callstack.cpp
//------------------------------------------------------------------------------------------------------------------------------
// FOR USE IN VISUAL STUDIO IMMEDIATE WINDOW
//------------------------------------------------------------------------------------------------------------------------------
// Dump Blueprint Callstack (UE4 Editor Build)
{,,UE4Editor-Core}::PrintScriptCallstack()
// Dump Blueprint Callstack (UE5 Editor Build)
{,,UnrealEditor-Core}::PrintScriptCallstack()
View cpp_high_resolution_timer.cpp
//------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <chrono>
//------------------------------------------------------------------------------------------------------------------------------
int main()
{
// Start timer
View uproperty_edit_conditions.cpp
//------------------------------------------------------------------------------------------------------------------------------
// Basic Usage
//------------------------------------------------------------------------------------------------------------------------------
UPROPERTY(EditAnywhere, Category="Demo")
bool MyFlag = true;
UPROPERTY(EditAnywhere, Category="Demo", meta=(EditCondition="MyFlag"))
int MyNumber = 0;
//------------------------------------------------------------------------------------------------------------------------------
// Basic Usage (Inverted)
@tmsampson
tmsampson / cpp_const_usage.cpp
Last active April 27, 2023 13:15
C++ Const Pointer Usage
View cpp_const_usage.cpp
//------------------------------------------------------------------------------------------------------------------------------
struct MyType
{
int x = 0;
void Mutate() { ++x; }
};
//------------------------------------------------------------------------------------------------------------------------------