Skip to content

Instantly share code, notes, and snippets.

View SiarheiPilat's full-sized avatar
:octocat:
Working from home

suasor SiarheiPilat

:octocat:
Working from home
  • Suasor AB
  • Malmö, Sweden
View GitHub Profile
@Syy9
Syy9 / GetUnityTypes.cs
Last active November 4, 2022 13:02
How to get all EditorWindow types in Unity
using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEditor;
public static class GetUnityTypes
{
public static List<Type> GetEditorWindowTypes()
{
var result = GetSubClassTypes<EditorWindow>();
@Syy9
Syy9 / UnityEditorWindowHelper.cs
Created July 28, 2018 07:32
How to get Unity default EditorWindow (Game, Scene, Hierarchy...)
using UnityEngine;
using UnityEditor;
using System;
public enum WindowType
{
Game,
Scene,
Hierarchy,
Console,
@James-Frowen
James-Frowen / ExampleInterface.cs
Last active July 20, 2023 15:07
Unity3d, How to show an interface field in Inspector
namespace JamesFrowen
{
public interface ISomeInterface
{
void SomeMethod();
}
[System.Serializable]
public class SomeInterfaceWrapper : InterfaceWrapper<ISomeInterface>
{
@satanas
satanas / scrolling_bg.md
Last active December 29, 2023 01:07
Scrolling Background in Unity

Scrolling Background in 2D

  1. Select the original Texture (not the GameObject).
  2. Change Texture Type to Sprite (2D and UI).
  3. Change Wrap Mode to Repeat.
  4. Click Apply.
  5. Create a Quad object: GameObject -> 3D Object ->Quad.
  6. Scale the Quad to the size you want.
  7. Create a light: GameObject->Light->Directional Light.
  8. Adjust the light intensity to whatever you like.
@lawrence-laz
lawrence-laz / BaseBehaviour.cs
Created November 30, 2018 18:00
Automatically get components in Unity using [GetComponent] attribute
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
public class BaseBehaviour : MonoBehaviour
{
protected virtual void OnEnable()
{
@LotteMakesStuff
LotteMakesStuff / AutohookAttribute.cs
Last active March 18, 2025 14:51
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
// NOTE DONT put in an editor folder!
using UnityEngine;
public class AutohookAttribute : PropertyAttribute
{
}
@LotteMakesStuff
LotteMakesStuff / LayoutUtils.cs
Last active November 2, 2023 21:04
Simple tool for importing editor layout files (.wlt files) from the asset folder. this is cool cos you can then share layouts with your team via source control
// put me in an Editor folder
using System.IO;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
public static class LayoutUtils
{
// unity stores layouts in a path referenced in WindowLayout.LayoutsPreferencesPath.
// Unfortunately, thats internal - well just creat the path in the same way they do!
using UnityEditor;
using UnityEngine;
/// <summary>
/// Folder organizer editor window.
/// http://diegogiacomelli.com.br/using-an-assetpostprocessor-editorwindow-to-keep-assets-organized-on-unity-projects
/// </summary>
public class FolderOrganizerEditorWindow : EditorWindow
{
FolderOrganizerSettings _settings;
using UnityEditor;
using UnityEngine;
public static class TransformContextMenu
{
[MenuItem("CONTEXT/Transform/Make a circle")]
public static void MakeCircle()
{
var length = Selection.gameObjects.Length;
var radius = 5;
using UnityEngine;
using UnityEditor;
/// <summary>
/// Hierarchy Window Group Header
/// http://diegogiacomelli.com.br/unitytips-hierarchy-window-group-header
/// </summary>
[InitializeOnLoad]
public static class HierarchyWindowGroupHeader
{