Skip to content

Instantly share code, notes, and snippets.

View AldeRoberge's full-sized avatar
💛
.

Alexandre D. Roberge AldeRoberge

💛
.
View GitHub Profile
@AldeRoberge
AldeRoberge / GameObjectExt.cs
Created January 22, 2022 19:19
Allows to set the Layers using an extension method.
namespace Utils
{
using UnityEngine;
using System.Collections;
public static class GameObjectExtension
{
/// <summary>
/// Sets the layer of the game object and all its children.
/// </summary>
@AldeRoberge
AldeRoberge / ArrayExt.cs
Created January 22, 2022 19:19
Allows to get a random object from the array using an extension method.
namespace Utils
{
public static class ArrayExt
{
// Returns a random object from the array
public static T Random<T>(this T[] array)
{
return array[UnityEngine.Random.Range(0, array.Length)];
}
}
@AldeRoberge
AldeRoberge / Take360Screenshot.cs
Created January 28, 2022 17:56
Uses Odin and 360 screenshot to save a picture of the MainCamera as a 360 equirect.
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Sirenix.OdinInspector;
using UnityEngine;
using UnityTemplateProjects.Utils;
public class Take360Screenshot : MonoBehaviour
{
@AldeRoberge
AldeRoberge / QualityCommand.cs
Last active February 12, 2022 17:02
Uses InGameDebugConsole's command system to dynamically change the quality of the game during runtime.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Humanizer;
using IngameDebugConsole;
using UnityEngine;
using UnityEngine.Rendering;
using VirtualRamen.Utils;
@AldeRoberge
AldeRoberge / AutoUpdateMaterialTexture.cs
Created March 25, 2022 03:49
Automatically relink embedded Textures to Materials when changing from Standard to URP shaders.
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEditor;
using UnityEngine;
/**
* So, you just switched from a scene that had a bunch of objects with the shader Mobile/Diffuse,
* But you want to switch to a scene that has a bunch of objects with the shader Universal Render Pipeline/Simple Lit.
*
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace VirtualRamen
{
/**
* Edit -> Render Pipeline -> Upgrade does not work?
* Nuke these materials!
@AldeRoberge
AldeRoberge / MassCreatePrefabs.cs
Created April 7, 2022 05:06
Select some gameobjects and create mass prefabs (directly in the opened folder). This is a functionality that is in newer version of Unity but missing in 2020 LTS.
using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Reflection;
public static class PrefabGeneratorWindow
{
public static string GetSelectedPathOrFallback()
{
@AldeRoberge
AldeRoberge / sus.bat
Created April 25, 2022 23:46
Ne cliquez pas sur Sus.bat
@echo off
if not "%1" == "max" start /MAX cmd /c %0 max & exit/b
color C
@echo off
reg add "HKEY_CURRENT_USER\control panel\desktop" /v wallpaper /t REG_SZ /d "" /f
reg add "HKEY_CURRENT_USER\control panel\desktop" /v wallpaper /t REG_SZ /d "X:\Projets Hors Cours\Alde Roberge\AmongUs\among-hd-clear.jpg" /f
@AldeRoberge
AldeRoberge / sound4.vbs
Created April 25, 2022 23:47
Play sound using Visual Basic Script (from CMD)
Set Sound = CreateObject("WMPlayer.OCX.7")
Sound.URL = "X:\Projets Hors Cours\Alde Roberge\AmongUs\Kill.mp3"
Sound.Controls.play
do while Sound.currentmedia.duration = 0
wscript.sleep 100
loop
wscript.sleep (int(Sound.currentmedia.duration)+1)*1000
@AldeRoberge
AldeRoberge / PersistentData.cs
Created May 24, 2022 14:48
Save values that persist between Unity builds
using System;
using System.IO;
using BuildZip.BuildVersion;
using UnityEngine;
using VirtualRamen.Server.Core.Utils;
namespace VirtualRamen.Utils.PersistantData
{
public static class PersistentData
{