Skip to content

Instantly share code, notes, and snippets.

@Aaron8052
Aaron8052 / 1减少不必要的Update调用.md
Last active January 5, 2024 02:30
Unity游戏优化(四)减少不必要的Update调用

Unity游戏优化(四)减少不必要的Update调用

很多 Update() 内的代码实际上并不需要每帧调用(自行判断),可以考虑改用 FixedUpdate()Coroutine InvokeRepeating()限制代码的调用频率

详见下方代码示例

@Aaron8052
Aaron8052 / 1对象缓存.md
Last active January 5, 2024 02:24
Unity游戏优化(三)对象缓存

Unity游戏优化(三)对象缓存

对于需要多次引用的对象,例如Transform,或其他对象,建议将其缓存到一个变量中以供后续使用,以减少不必要的开销。

@Aaron8052
Aaron8052 / 移除空回调定义.md
Last active January 5, 2024 02:24
Unity游戏优化(二)移除空回调定义

Unity游戏优化(二)移除空回调定义

Unity创建脚本时会自动包含Start()Update() 这两个方法。如果你用不到它们,请记得移除,因为这些方法不论是否为空,Unity都始终会调用它们

@Aaron8052
Aaron8052 / GetComponent变体.md
Last active January 5, 2024 21:25
Unity游戏优化(一)GetComponent变体

Unity游戏优化(一)GetComponent变体

GetComponent主要有三种变体:

  1. GetComponent("string")
  2. GetComponent<Type>()以及
  3. GetComponent(typeof(Type))

经过1000000次的循环测试后,第二种执行最快,仅89ms; 其次是第三种,95ms,仅相差6ms;

@Aaron8052
Aaron8052 / GiveawayWinnersGenerator.cpp
Last active December 12, 2023 02:29
【DL 7周年抽奖活动】GiveawayWinnersGenerator
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <ctime>
#include <cstdlib>
using namespace std;
@Aaron8052
Aaron8052 / SerializableDictionary.cs
Last active February 20, 2023 23:21
Unity Serializable Dictionary
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, ISerializationCallbackReceiver
{
[Serializable]
public struct KeyValue
{
@jogerj
jogerj / Genshin Impact 4.x Wish URL.md
Last active July 3, 2024 20:24
Get Wish History URL in Genshin Impact 4.7 on PC from cache

Usage

Win+R and paste following

  • All versions (Global/China)
powershell iex (irm 'https://gist.githubusercontent.com/jogerj/0339e61a92e0de2e360c5212a94854e8/raw/get_wish_url_from_cache.ps1')
  • for (Powershell 6+)
pwsh -Command iex (irm 'https://gist.githubusercontent.com/jogerj/0339e61a92e0de2e360c5212a94854e8/raw/get_wish_url_from_cache.ps1')
@ejdyksen
ejdyksen / patch-edid.md
Last active July 26, 2024 11:46
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):