Skip to content

Instantly share code, notes, and snippets.

View AndrewDavid's full-sized avatar
🌭
Making dumb content

Andrew-David J. AndrewDavid

🌭
Making dumb content
View GitHub Profile
@ghysc
ghysc / MaterialGradientDrawer.cs
Last active June 9, 2022 13:19 — forked from totallyRonja/MaterialGradientDrawer.cs
A Material Property Drawer for the [Curve] attribute which lets you edit curves and adds them to the shader as textures. Forked from Ronja's Material Gradient Drawer. More information here: https://twitter.com/CyrilJGhys/status/1529496742642728964 and here: https://twitter.com/totallyRonja/status/1368704187580682240
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
public class MaterialCurveDrawer : MaterialPropertyDrawer {
private int resolution;
@yasirkula
yasirkula / PaddingIgnoringImage.cs
Last active January 2, 2024 18:46
Modified version of Image component that ignores the sprite's padding in Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Sprites;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
#if UNITY_EDITOR
using UnityEditor;
@SaeedPrez
SaeedPrez / AudioVisualizer.cs
Created February 3, 2022 17:42
Simple audio visualizer for Unity
using System.Linq;
using UnityEngine;
[RequireComponent(typeof(AudioSource))]
public class AudioVisualizer : MonoBehaviour
{
[SerializeField] private float barWidth = 0.1f;
[SerializeField] private float updateDelay = 0.04f;
[SerializeField] private Color[] barColors;
[SerializeField] private float barMultiplier = 2f;
@omid3098
omid3098 / ObjectActivationSwitch.cs
Created February 3, 2022 16:25
A tiny little editor window to switch objects activation state
/*
Copyright (c) 2022 Omid Saadat
Licensed under the MIT License (Do whatevever you want with this!);
*/
using UnityEngine;
using UnityEditor;
public class ObjectActivationSwitch : EditorWindow
{
[MenuItem("LeMoonade/ObjectActivationSwitch")]
@staggartcreations
staggartcreations / GlobalShaderParams.cs
Last active January 18, 2024 08:40
Component for passing values through Shader.SetGlobalXXX
using System;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class GlobalShaderParams : MonoBehaviour
{
@staggartcreations
staggartcreations / Rope.cs
Last active March 6, 2024 12:58
HingeJoint-based rope building component
using System;
using UnityEngine;
using UnityEngine.Serialization;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class RopeGenerator : MonoBehaviour
{
public Rigidbody attachementBody;
@metaphore
metaphore / HqnxEffect.java
Last active September 7, 2023 10:05
[libGDX] HQX (HQ2X, HQ3X, HQ4X) upscaling filter implementation (Java and Kotlin) using GLSL shaders.
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.VertexAttributes.Usage;
import com.badlogic.gdx.graphics.glutils.FrameBuffer;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
import com.badlogic.gdx.utils.Disposable;
import com.badlogic.gdx.utils.GdxRuntimeException;
/**
@staggartcreations
staggartcreations / SpriteWaterShape.cs
Last active January 18, 2024 08:50
Sprite shape animated water volume
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.U2D;
[ExecuteInEditMode]
public class SpriteWaterShape : MonoBehaviour
{
public SpriteShapeController controller;
@staggartcreations
staggartcreations / CinemachinePathShape.cs
Created January 5, 2020 08:51
Unity script for creating a circular, arched or spiraling cinemachine path
using UnityEngine;
using Cinemachine;
using Waypoint = Cinemachine.CinemachineSmoothPath.Waypoint;
public class CinemachinePathShape : MonoBehaviour
{
public CinemachineSmoothPath path;
[Space]
@staggartcreations
staggartcreations / CreatePlaneStack.cs
Created December 31, 2019 12:02
Unity script for creating a stacked plane mesh
using UnityEngine;
[ExecuteInEditMode]
public class CreatePlaneStack : MonoBehaviour
{
public MeshFilter meshFilter;
[Range(1, 64)]
public int layers = 4;
[Space]