Skip to content

Instantly share code, notes, and snippets.

View noisecrime's full-sized avatar

NoiseCrime noisecrime

View GitHub Profile
@runevision
runevision / Unity versions not affected by Unity Runtime Fee.md
Created September 14, 2023 09:45
Unity versions not affected by Unity Runtime Fee

Unity versions not affected by Unity Runtime Fee

This is information that has been dug up by me and others in the Unity community. It's not official information from Unity (but most of the linked resources are). It is also not legal advise. I am not a lawyer.

TLDR:

Contrary to what Unity themselves are saying, for games made with these Unity versions, developers can elect not to be affected by a newer version of the Terms of Service that introduces the Unity Runtime Fee:

  • Unity 2022.x or earlier
  • Unity 2021.x LTS or earlier
@MidSpike
MidSpike / readme.md
Last active February 5, 2024 18:09
CVE-2022-23812 | RIAEvangelist/node-ipc is malware / protest-ware
@Cyanilux
Cyanilux / RenderToDepthTexture.cs
Last active March 14, 2024 16:07
URP Render Feature that manually renders DepthOnly pass to _CameraDepthTexture, filtered by LayerMask. Tested in URP v10, Unity 2020.3
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
/*
- Renders DepthOnly pass to _CameraDepthTexture, filtered by LayerMask
- If the depth texture is generated via a Depth Prepass, URP uses the Opaque Layer Mask at the top of the Forward/Universal Renderer asset
to determine which objects should be rendered to the depth texture. This feature can be used to render objects on *other layers* into the depth texture as well.
/*
* Legacy Particle System Updater
* A tool that can be used to convert Legacy Particle Systems into new Particle System Components.
* https://forum.unity.com/threads/release-legacy-particle-system-updater.510879/
*
* v1.0
* Initial release
*
* v1.1
* Fixed incorrect billboard mode
@karljj1
karljj1 / Unity Assembly Definition Debugger.cs
Last active March 27, 2024 17:18
Find out what assemblies are being built and how long each takes.
using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
[InitializeOnLoad]
public class AsmdefDebug
{
@LotteMakesStuff
LotteMakesStuff / NativeMeshTest.cs
Created August 8, 2018 00:30
[NativeCollections] How to copy a regular .C# array into a NativeArray suuuuuper quick using memcpy. its about as fast as its ever gunna get!
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMeshTest : MonoBehaviour
{
private NativeArray<float3> vertexBuffer;
private Vector3[] vertexArray;
@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!

@sebbbi
sebbbi / fast_spheres.txt
Created February 18, 2018 19:31
Fast way to render lots of spheres
Setup:
1. Index buffer containing N quads (each 2 triangles), where N is the max amount of spheres. Repeating pattern of {0,1,2,1,3,2} + K*4.
2. No vertex buffer.
Render N*2 triangles, where N is the number of spheres you have.
Vertex shader:
1. Sphere index = N/4 (N = SV_VertexId)
2. Quad coord: Q = float2(N%2, (N%4)/2) * 2.0 - 1.0
3. Transform sphere center -> pos
@davehampson
davehampson / ShipCamera.cs
Last active January 31, 2023 23:21
Framerate independent blend
using UnityEngine;
public class ShipCamera : MonoBehaviour
{
public GameObject m_Ship;
public Vector3 m_RelativePos;
void LateUpdate()
{
//float scale = 0.05f; // Framerate dependent code, bad.
@FreyaHolmer
FreyaHolmer / int2.cs
Last active November 2, 2023 15:59
int2 type for Unity
/////////////////////////////////////////////////////////////////////////////
// int2 is similar to Vector2, but with integers instead of floats
// Useful for various grid related things.
//
// - Swizzle operators xx/xy/yx/yy
// - Extended arithmetic operators similar to shader data types
// A few examples:
// int2(8,4) / int2(2,4) -> int2(4,1)
// 16 / int2(2,4) -> int2(8,4)
// int2(2,3) * int2(4,5) -> int2(8,15)