Skip to content

Instantly share code, notes, and snippets.

View badscotsman's full-sized avatar

Scott H. Cameron badscotsman

View GitHub Profile
@badscotsman
badscotsman / SceneSelectorConfigSO.cs
Created August 30, 2024 11:21
A simple Scene selector Overlay
using UnityEngine;
namespace SceneSelector
{
[CreateAssetMenu(fileName = "SceneSelectorConfig", menuName = "Editor/Scene Selector Configuration", order = 1)]
public class SceneSelectorConfigSO : ScriptableObject
{
public string SceneFilter = "t:Scene";
public string[] SceneNames;
public string[] PreferredScenePaths;
@badscotsman
badscotsman / NamespaceCustomLogoDrawer.cs
Created May 5, 2024 14:34
Draw a logo at the top of components in the Unity Inspector based on namespace.
using UnityEditor;
using UnityEngine;
namespace MyNamespace.Common.EditTime
{
[CustomEditor(typeof(MonoBehaviour), true), CanEditMultipleObjects]
public class NamespaceCustomLogoDrawer : UnityEditor.Editor
{
private const string NAMESPACE_PREFIX = "MyNamespace";
private Texture2D _namespaceIcon;
@badscotsman
badscotsman / SceneSavedNotification.cs
Created November 13, 2023 10:45
Show a notification in the Unity scene View when a scene is saved. Can toggle showing from the file menu.
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
public class SceneSavedNotification
{
private const string PREFS_KEY = "SceneSavedNotificationShow";
[MenuItem("Tools/Toggle Scene Saved Notification")]
private static void ToggleNotification()
@badscotsman
badscotsman / IncrementalSaveProcess.ps1
Created May 20, 2023 11:41
This PowerShell script monitors a file for changes and makes a backup whenever it is modified.
<#
If you want to enable running scripts, you can set the execution policy to RemoteSigned or Unrestricted. Keep in mind that this will reduce the security of your system, so make sure you understand the implications.
You can set the execution policy for the current user to RemoteSigned with:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Set-ExecutionPolicy Restricted -Scope CurrentUser (Default)
#>
<#
@badscotsman
badscotsman / CountdownController.cs
Created September 22, 2022 08:28
A reusable countdown controller component for Unity.
using UnityEngine;
using UnityEngine.Events;
using TMPro;
public class CountdownController : MonoBehaviour
{
[SerializeField] private int _count = 3;
[SerializeField] private TMP_Text _countdownLabel;
[SerializeField] private string _countdownFinishText = "Go!";