Skip to content

Instantly share code, notes, and snippets.

View noisecrime's full-sized avatar

NoiseCrime noisecrime

View GitHub Profile
@noisecrime
noisecrime / AssetsMenu_ReferenceChecker.cs
Last active March 21, 2024 20:50
WIP - Simple editor script to provide options in dropdown menu when clicking on an asset in the project browser to discover what other assets/scenes reference it.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEngine;
namespace NoiseCrimeStudios.Core.Editor.Asset.Tools
{
/// <summary>
/// Editor functions to obtain useful information about Assets in Project Browser.

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
@noisecrime
noisecrime / InternalScreenShotting.cs
Last active March 19, 2021 03:14
Exposes the native Unity 'ScreenShotting' methods to Unity Menu & Shortcut keys.
using UnityEditor;
using UnityEngine;
namespace NoiseCrimeStudios.Editor.Internal
{
/// <summary>
/// Exposes the native Unity 'ScreenShotting' methods to Unity Menu & Shortcut keys.
/// </summary>
/// <remarks>
/// Once imported you can find the menu in either Window/Analysis/Screenshot or Window/Internal/Screenshot.
@noisecrime
noisecrime / Unity Assembly Definition Debugger.cs
Created January 19, 2020 14:02 — forked from karljj1/Unity Assembly Definition Debugger.cs
Find out what assemblies are being built and how long each takes.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
namespace NoiseCrimeStudios.Editor.Settings
{
@noisecrime
noisecrime / ResourceChecker.cs
Last active October 11, 2021 14:00
Unity: Quick update to original 'Unity-Resource-Checker' to use native Unity methods for obtaining the memory size of textures.
// Resource Checker
// (c) 2012 Simon Oliver / HandCircus / hello@handcircus.com
// (c) 2015 Brice Clocher / Mangatome / hello@mangatome.net
// Public domain, do with whatever you like, commercial or not
// This comes with no warranty, use at your own risk!
// https://github.com/handcircus/Unity-Resource-Checker
// (c) 2019 NoiseCrime
// Quick update to use native Unity methods to obtain the size of textures.
// Looking through the code much has changed since this class was first created
// as such it requires a full rewrite to fix various issues and robustly deal
@noisecrime
noisecrime / UpdateInspectorBehaviour.cs
Created September 13, 2018 11:36
Example of how to expose a field from a class reference and have it update the inspector at an 'appropriate' framerate
using UnityEngine;
public class UpdateInspectorBehaviour : MonoBehaviour
{
public class CustomValueClass
{
public int _MyUpdatingValue;
}
public CustomValueClass _CustomValueClass;
@noisecrime
noisecrime / WebcamProcessingTesting.cs
Created May 1, 2018 06:58
Optimizing step for WebProcessing
using UnityEngine;
using Unity.Jobs;
using Unity.Collections;
using Unity.Mathematics;
public class WebcamProcessingTesting : MonoBehaviour
{
[SerializeField]
[Tooltip("Which webcam to use")]
int m_WebcamIndex;
@noisecrime
noisecrime / StopWatchProfiler
Created September 10, 2017 10:31
StopWatchProfiler
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
#if UNITY_5_5_OR_NEWER
using Profiler = UnityEngine.Profiling.Profiler;
#endif
public class StopWatchProfiler : MonoBehaviour
float4 vTexels;
vTexels.x = LastMip.Load( nCoords );
vTexels.y = LastMip.Load( nCoords, uint2(1,0) );
vTexels.z = LastMip.Load( nCoords, uint2(0,1) );
vTexels.w = LastMip.Load( nCoords, uint2(1,1) );
float fMaxDepth = max( max( vTexels.x, vTexels.y ), max( vTexels.z, vTexels.w ) );
cbuffer CB
{
matrix View;
matrix Projection;
matrix ViewProjection;
float4 FrustumPlanes[6]; // view-frustum planes in world space (normals face out)
float2 ViewportSize; // Viewport Width and Height in pixels