Skip to content

Instantly share code, notes, and snippets.

View DarkenedShade's full-sized avatar
:shipit:

DarkenedShade

:shipit:
  • @timeplayinc
  • Toronto
View GitHub Profile
using System.Collections;
using System.Collections.Generic;
using Junaid.Utilities;
using Sirenix.OdinInspector;
using UnityEngine;
namespace BL.Managers
{
public class GameManager : Singleton<GameManager>
{
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;
namespace Junaid.Utilities
{
// This class derived was from https://gamedev.stackexchange.com/a/151547
public abstract class Singleton<T> : MonoBehaviour where T : MonoBehaviour
@DarkenedShade
DarkenedShade / EditorResetPrefs.cs
Last active April 23, 2023 01:44
A Uitility to delete all editor prefernces
// Found At https://answers.unity.com/questions/633474/how-to-remove-options-from-the-external-tools-exte.html
using UnityEditor;
using UnityEngine;
public class EditorResetPrefs : MonoBehaviour
{
[MenuItem ("Edit/Reset Preferences")]
static void ResetPrefs()
{
@DarkenedShade
DarkenedShade / EditorMenus.cs
Created March 13, 2019 15:23
Add an inspector lock button shortcut
using UnityEditor;
static class EditorMenus
{
// taken from https://devdog.io/blog/16-best-unity-tips-for-game-developers-81/
// https://twitter.com/SiarheiPilat/status/1100912085477871617?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1100912085477871617&ref_url=https%3A%2F%2Fdevdog.io%2Fblog%2F16-best-unity-tips-for-game-developers-81%2F
// direved from https://answers.unity.com/questions/282959/set-inspector-lock-by-code.html
[MenuItem("Tools/Toggle Inspector Lock %l")]
static void ToggleInspectorLock()
{
@DarkenedShade
DarkenedShade / SomeFile.cs
Created March 13, 2019 15:13
Odin drag area in inspector
// From the Sirenix discord channel
[OnInspectorGUI]
private void DrawAreaThing()
{
Rect rect = EditorGUILayout(false, 500); // Allocate an area in the GUILayout system.
SirenixEditorGUI.DrawBorders(rect, 1);
if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && rect.Contains(Event.currrent.mousePosition))
using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;
public class CameraController : MonoBehaviour
{
public GameObject target;
public float panSpeed = 50.0f;
public bool simpleVerticalRotate = true;