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
//------------------------------------------------------------------------------------------------------------------------------
// Basic Usage
//------------------------------------------------------------------------------------------------------------------------------
UPROPERTY(EditAnywhere, Category="Demo")
bool MyFlag = true;
UPROPERTY(EditAnywhere, Category="Demo", meta=(EditCondition="MyFlag"))
int MyNumber = 0;
//------------------------------------------------------------------------------------------------------------------------------
// Basic Usage (Inverted)
//------------------------------------------------------------------------------------------------------------------------------
#include <iostream>
#include <chrono>
//------------------------------------------------------------------------------------------------------------------------------
int main()
{
// Start timer
@tmsampson
tmsampson / ue4_networking_watch_window_helpers.txt
Created November 8, 2020 14:19
UE4 Networking Watch Window Helpers
/* --- 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
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
// Overview
//----------------------------------------------------------------------------------------------------------
// GeneratePreProcessorDefinition takes an input string and returns a C++ style pre-processor definition
//----------------------------------------------------------------------------------------------------------
// Usage
//----------------------------------------------------------------------------------------------------------
// string PreProcessorDefinition = GeneratePreProcessorDefinition("Input String");
//----------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------
// 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
@tmsampson
tmsampson / cpp_const_usage.cpp
Last active April 27, 2023 13:15
C++ Const Pointer Usage
//------------------------------------------------------------------------------------------------------------------------------
struct MyType
{
int x = 0;
void Mutate() { ++x; }
};
//------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------
// 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()