Skip to content

Instantly share code, notes, and snippets.

View Novack's full-sized avatar

Novack

View GitHub Profile
using UnityEngine;
public class LazyngletonBehaviour<T> : MonoBehaviour where T : LazyngletonBehaviour<T> {
private static T _instance;
public static T Instance {
get{
if(_instance == null){
GameObject newInstance = new GameObject();
_instance = newInstance.AddComponent<T>();
@Novack
Novack / ServiceLocator.cs
Created October 25, 2024 21:38 — forked from j4rv/ServiceLocator.cs
Unity Service Locator Component
using System.Collections.Generic;
using UnityEngine;
public class ServiceLocator : MonoBehaviour {
private Dictionary<System.Type,Object> cache = new Dictionary<System.Type,Object>();
private static ServiceLocator _singleton;
private static ServiceLocator singleton {
get {
@Novack
Novack / EditorGUIIconGenerator.cs
Created October 23, 2024 14:33 — forked from ChristopherSchubert/EditorGUIIconGenerator.cs
This script makes using Unity3D EditorGUI icons simple. It should work in any version of the Editor, because it scans the editor for icons rather than hard-coding them. Drop the script in your project, and then navigate to the menu "Tools > EditorGUI Icons > Explore". The UI will show you the icons, let you regex search them, and if you click th…
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.Experimental;
using UnityEngine;
@Novack
Novack / README.md
Created January 5, 2021 14:47 — forked from JohannesDeml/README.md
Remove Unity Mobile Notification Warning for WebGL builds

Remove warning

Unity has a warning when running a webgl build on mobile (iOS, Android). In order to remove it, just add this file to an editor folder.

Live example

To see live examples see Unity Web GL Loading Test

Logic

The script will run after the build has completed and replace the checks from all generated javascript files.

Support

@Novack
Novack / UnityProjectJunctionTool.cs
Created September 2, 2020 02:41 — forked from IronWarrior/UnityProjectJunctionTool.cs
Unity editor tool to create dummy Unity projects to allow a single project to be open in multiple editor instances.
// CONTRIBUTIONS:
// Mac and Linux support added by Creature Coding: https://creaturecoding.com/
//
// PURPOSE:
// Unity does not permit a project to be open in two different editor instances.
// This can be frustrating when building projects with multiplayer networking,
// as it would require you to create a build every time you wish you test your netcode.
// A workaround would be to duplicate the project, but this would require the duplicated
// project to be updated each time a change is made.
//
using UnityEditor;
using UnityEngine.LowLevel;
using UnityEngine.UIElements;
public class ShowPlayerLoopWindow : EditorWindow
{
[MenuItem("Window/Player Loop")]
static void ShowWindow()
{
var wind = GetWindow<ShowPlayerLoopWindow>(false, "Player Loop");
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop;
public static class AddPlayerLoopCallback
{
// Add a callback to the PreUpdate phase
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Setup()
{
@Novack
Novack / GizmosExtensions.cs
Created August 1, 2020 21:28 — forked from luisparravicini/GizmosExtensions.cs
Method to draw an arc with Unity's Gizmos
using UnityEngine;
public class GizmosExtensions
{
private GizmosExtensions() { }
/// <summary>
/// Draws a wire arc.
/// </summary>
/// <param name="position"></param>
@Novack
Novack / v9-voice-receive.js
Created July 29, 2020 18:31
Discord.js V9 Voice Recorder
const Discord = require("discord.js");
const fs = require('fs');
const client = new Discord.Client();
const config = require('./auth.json');
// make a new stream for each time someone starts to talk
function generateOutputFile(channel, member) {
// use IDs instead of username cause some people have stupid emojis in their name
using System;
using UnityEditor;
using UnityEngine;
public class CopyPasteValues
{
static string copyBuffer;
static Type copyType;
[MenuItem("CONTEXT/Component/Copy Values With Json")]