Skip to content

Instantly share code, notes, and snippets.

View nicetrysean's full-sized avatar

Sean O'Dowd nicetrysean

View GitHub Profile
@nicetrysean
nicetrysean / CameraPan.cs
Last active October 3, 2022 14:58
Camera Panning via DoTween on click and drag of mouse
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
public class CameraPan : MonoBehaviour
{
[SerializeField] private new Camera camera;
[SerializeField] private Ease easeType = Ease.OutExpo;
[SerializeField] private float inertiaDuration = .33f;
@nicetrysean
nicetrysean / CameraZoom.cs
Created October 3, 2022 13:25
Zoom via scroll wheel using DoTween
using System;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using UnityEngine;
public class CameraZoom : MonoBehaviour
{
[SerializeField] private new Camera camera;
[SerializeField] private Ease easeType = Ease.InOutExpo;
@nicetrysean
nicetrysean / CustomDomainReloadTiming.cs
Created August 18, 2022 12:10
Manage domain reloads. Useful when Rider triggers a domain reload, and then Unity redundantly triggers one upon entering playmode
public static class CustomDomainReloadTiming
{
private const string MenuPath = "Tools/Manage Domain Reload";
private const int PlaysAllowedWithoutDomainReload = 1;
private static int _playCountWithoutDomainReload = 0;
[MenuItem(MenuPath, true)]
static bool ValidateLogSelectedTransformName()
{
Menu.SetChecked(MenuPath, IsEnabled);
@nicetrysean
nicetrysean / SceneSkipper.cs
Created November 16, 2017 11:26
Skip scenes with key presses
using System;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace SeanHelpsWithThese.Scripts
{
public class SceneSkipper : MonoBehaviour
{
[Serializable]
public class SceneKey
@nicetrysean
nicetrysean / CompherensiveSlider.cs
Last active July 28, 2017 06:56
Script for both TextInput and Slider UnityUI
public class CompherensiveSlider : MonoBehaviour
{
//Since we're using UnityEvent<T0> we need to implement the float type
[Serializable]
public class FloatEvent : UnityEvent<float> { }
public FloatEvent ValueChanged;
[SerializeField] //Display private variable in Inspector
private InputField _inputField;
@nicetrysean
nicetrysean / DiceProbabilityProgram.cs
Created December 8, 2016 23:46
Probability of hitting a target given the chance to reroll the lowest die
using System;
namespace Probability
{
internal class Program
{
private struct RollAttempt
{
public int Result;
public int[] Rolls;
@nicetrysean
nicetrysean / Sketch0.pde
Created December 7, 2016 13:24
First Processing Sketch
color[] indexedColors = {
color(180,205,60),
color(223,175,74),
color(240,82,42),
color(241,235,216),
color(0,140,114),
color(0,105,168),
color(125,123,125),
color(163,157,171),
color(230,200,187),
@nicetrysean
nicetrysean / UnityPackageRelease.md
Created June 5, 2016 00:22
Automate UnityPackage to Github Releases

Update Github Releases with UnityPackage

Github's API can be a bit wordy to work with just in bash, so I'm using github-release to simplify what we're doing.

On OSX you can install it via Homebrew:

brew install github-releases
@nicetrysean
nicetrysean / TextForm.cs
Created May 24, 2016 10:31
Submit a string with a simple InputLabel and Button! (Unity 5.1+)
using System;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.Events;
using UnityEngine.UI;
public class TextForm : MonoBehaviour
{
//Since we're using UnityEvent<T0> we need to implement the string type
public class TextEvent : UnityEvent<string> { }
@nicetrysean
nicetrysean / gist:9b5446bbc383d1c7fd91
Created January 21, 2015 00:59
Unity 3D Apply Syntax settings
{
// If you want exceptions reraised so you can see them in the console, change this to true.
"reraise_exceptions": false,
// If you want to have a syntax applied when new files are created, set new_file_syntax to the name of the syntax to use.
// The format is exactly the same as "name" in the rules below. For example, if you want to have a new file use
// JavaScript syntax, set new_file_syntax to 'JavaScript'.
"new_file_syntax": false,
// Put your custom syntax rules here: