Skip to content

Instantly share code, notes, and snippets.

View Lawendt's full-sized avatar
😺
🐱

Luiz Wendt Lawendt

😺
🐱
View GitHub Profile
@intaxwashere
intaxwashere / customthunkexample.md
Last active June 29, 2024 19:55
Custom Thunks Unreal Engine TL;DR

Custom thunks TL;DR

This smol post assumes you worked on a custom thunk implementation before but no idea how it works, why you're using cursed macros from 1990s etc. If you don't have any programming experience or relatively new to Unreal world, it's likely you might not understand anything from this post, not because concepts are too difficult to grasp, but rather because this post is written for the people who has an understanding of how Unreal works since a while and want to expand their knowledge of custom thunks implementation.

Part 1:

  • A thunk is a function that you can save and call later, so if you had an array of TFunction<void()>s, you would have an array of custom thunks that you can bind/unbind new function pointers to existing TFunctions.
  • Custom thunks of Blueprints are the same, they're a fancy array/list of function pointers. Imagine for each node you placed to graph, Blueprints have a place for that node in it's list of custom thunks. For example the + node in Blueprints that
@rtm223
rtm223 / RTMBlueprintCompiler_MustImplementFunction.cpp
Last active July 20, 2023 19:22
UFUNCTION(meta=(MustImplementInBlueprint))
#include "RTMBlueprintCompiler_MustImplementFunction.h"
#define LOCTEXT_NAMESPACE "RTMValidator_MustImplementFunction"
bool URTMBlueprintCompiler_MustImplementFunction::CanValidateBlueprint(const UBlueprint* blueprint) const
{
switch(blueprint->BlueprintType)
{
case BPTYPE_Normal:
case BPTYPE_Const:
@oktomus
oktomus / fork-custom-commands.md
Last active May 31, 2024 16:50
Fork custom commands

With custom commands, you are one shortcut away to run commands thanks to the Quick Launch (Ctrl+P, ⌘+P).

Custom commands can be configured in File > Preferences > Custom commands, or by editing the json file custom-commands.json located in AppData/Local/Fork on Windows and ~/Library/Application Support/com.DanPristupov.Fork/custom-commands.json on MacOS.

Please share your own custom commands :)

How to use

Fork commands are posted as comments on this gist. Press CTRL+F to search for commands.

@FreyaHolmer
FreyaHolmer / Circular Circles.shader
Created March 4, 2019 20:25
A shader for rendering circles arranged in a circle. Written in CG for use in the Unity engine
Shader "Custom/Circular Circles" {
Properties {
_CircleCount ("Circle Count", Float ) = 8
_CircleRadius ("Circle Radius", Range(0, 1)) = 0.18
_CircleSharpness ("Circle Sharpness", Range(0, 0.999)) = 0.95
_GroupRadius("Group Radius", Range(0, 1)) = 0.6
}
SubShader {
Pass {
CGPROGRAM
@Biodam
Biodam / GameViewUtils.cs
Last active March 22, 2023 12:10
Bulk add game view resolutions and quick select custom resolutions with hotkeys. Download the file and add it to a Editor folder inside of your Assets.
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
using UnityEngine;
using UnityEditorInternal;
/// <summary>
/// Class to manipulate the gameview sizes.
/// Based on: https://answers.unity.com/questions/956123/add-and-select-game-view-resolution.html
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active January 5, 2023 20:54
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@reunono
reunono / CinemachineCameraShaker.cs
Last active January 16, 2023 07:51
Cinemachine camera shake
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Add this component to your Cinemachine Virtual Camera to have it shake when calling its ShakeCamera methods.
/// </summary>
public class CinemachineCameraShaker : MonoBehaviour
{
@ulrikdamm
ulrikdamm / EditPrefab.cs
Last active May 14, 2024 16:41
Unity editor script for better editing of prefabs. Put in Assets/Editor.
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
// Adds a "Edit Prefab" option in the Assets menu (or right clicking an asset in the project browser).
// This opens an empty scene with your prefab where you can edit it.
// Put this script in your project as Assets/Editor/EditPrefab.cs
public class EditPrefab {
static Object getPrefab(Object selection) {
@partlyhuman
partlyhuman / FindByGuid.cs
Last active November 21, 2023 14:53
Unity Find by GUID
using UnityEditor;
using UnityEngine;
namespace com.hololabs.editor
{
public class FindByGuid : EditorWindow
{
[MenuItem("Utility/Find Asset by Guid %&g")]
public static void DoFindByGuidMenu()
{
@LotteMakesStuff
LotteMakesStuff / HighlightAttribute.cs
Last active May 3, 2024 01:38
Having trouble finding the right property on a component cos theres just so many identical looking fields? Add some color to you inspectors! mark important property with a bright color so it always stands out, or supply a validation function so highlights show on values that would effect the current ingame logic!
// NOTE DONT put in an editor folder
using UnityEngine;
public class HighlightAttribute : PropertyAttribute
{
public HighlightColor Color;
public string ValidateMethod;
public object Value;