Skip to content

Instantly share code, notes, and snippets.

Avatar

Sabresaurus sabresaurus

View GitHub Profile
@sabresaurus
sabresaurus / DisplaySpriteOutline.cs
Created Sep 5, 2020
Getting Unity Sprite Outline
View DisplaySpriteOutline.cs
using UnityEditor;
using UnityEngine;
public class DisplaySpriteOutline : MonoBehaviour
{
[SerializeField] private Sprite sprite;
private void OnDrawGizmos()
{
TextureImporter textureImporter = (TextureImporter) AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(sprite.texture));
View SharedPaletteWindow.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / SharedPaletteData.cs
Created Nov 10, 2019
Part of SharedPaletteWindow, must be its own file so that Unity can serialize the scriptable object correctly.
View SharedPaletteData.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / PaletteWindow.cs
Last active May 12, 2020
From SabreCSG originally, a window with drag-drop boxes that you can drag common objects onto such as scenes, materials, prefabs to easily access them later
View PaletteWindow.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / ConditionalVisibilityAttribute.cs
Created Oct 16, 2019
Allows you to restrict visibility of serialised fields based on an attribute, e.g. [ConditionalVisibility("siblingBool","True"),SerializeField] float foo = 0;
View ConditionalVisibilityAttribute.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / MeshFilterInspector.cs
Created Oct 16, 2019
Provides some stats (e.g. vertex count) about a bound mesh on a MeshFilter's inspector
View MeshFilterInspector.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / RagdollTest.cs
Created Sep 15, 2019
Toggle between animations and ragdoll
View RagdollTest.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / WindowKiller.cs
Created Jan 29, 2019
If an editor window breaks (due to an issue with serialized internal state for example) it can be a pain to close and reopen it as the context menu for closing it no longer works. This utility allows you to close any editor window.
View WindowKiller.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / ConsoleCallStackHelper.cs
Last active May 2, 2020
Jump to file/line in the Unity console window callstack via this helper window
View ConsoleCallStackHelper.cs
// MIT License
//
// Copyright (c) 2018 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@sabresaurus
sabresaurus / PrefabExplorer.cs
Last active May 2, 2020
An editor window that shows the full hierarchy of a prefab selected in the Project window, allowing you to select objects in a prefab beyond the top two levels (Unity's project view recurses only one deep)
View PrefabExplorer.cs
// MIT License
//
// Copyright (c) 2019 Sabresaurus
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
You can’t perform that action at this time.