Skip to content

Instantly share code, notes, and snippets.

using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Pool;
using UnityEngine.Profiling;
public sealed class ListPoolExample : MonoBehaviour
{
private void Update()
{
Profiler.BeginSample("Bad"); //for performance measurements
using UnityEngine;
using UnityEngine.Profiling;
public sealed class RaycastExample : MonoBehaviour
{
private void Update()
{
Profiler.BeginSample("Bad"); //for performance measurements
//do 1000 raycasts
for (int i = 0; i < 1000; i++)
@swiftroll
swiftroll / GDExtensions.cs
Last active September 19, 2023 13:50
Godot C# GetChildByType<T>()
using Godot;
public static class GDExtensions
{
public static T GetChildByType<T>(this Node node, bool recursive = true)
where T : Node
{
int childCount = node.GetChildCount();
for (int i = 0; i < childCount; i++)