Skip to content

Instantly share code, notes, and snippets.

@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;
@staggartcreations
staggartcreations / HeightmapToMesh.cs
Created June 27, 2019 18:05
Convert heightmap to mesh
// Staggart Creations
// http://staggart.xyz
using UnityEngine;
[ExecuteInEditMode]
public class HeightmapToMesh : MonoBehaviour
{
public MeshFilter meshFilter;
public Texture2D heightmap;
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
vmImage: 'windows-2019'
/// For this to work you need to copy these 2 files:
/// "YOUR UNITY LOCATION"\Editor\Data\Mono\lib\mono\X.X\System.Drawing.dll
/// "YOUR UNITY LOCATION"\Editor\Data\Mono\lib\mono\X.X\System.Windows.Forms.dll
/// ..to a "Plugins" folder within your project
///
/// For this example to work, you need to have a (UI) Canvas object in your scene
/// Put this script on any object
///
/// Tested on windows, not sure if it works on any other platform
///
@QuantumCalzone
QuantumCalzone / LayoutElementExtended.cs
Last active April 1, 2021 23:08
An extension of Unity's LayoutElement script that enable more flexible adaptation such as matching another RecTransform's dimensions or setting maximum preferred values. Put the Inspector and Property Drawer scripts in an Editor folder. Also available as a package at https://github.com/QuantumCalzone/UnityLayoutElementExtended
using UnityEngine;
using UnityEngine.UI;
namespace QuantumCalzone
{
[AddComponentMenu("Layout/Extended/Layout Element Extended")]
[RequireComponent(typeof(RectTransform))]
public class LayoutElementExtended : LayoutElement
{
public LayoutElementExtendedValue MinWidthExtended = new LayoutElementExtendedValue();
@TarasOsiris
TarasOsiris / FlowMap.shader
Last active April 20, 2023 07:36
Flow Map Shader for Unity3D. Used with Sprites.
Shader "Custom/Flow Map"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
// Flow
_FlowMap ("Flow Map", 2D) = "white" {}
_FlowSpeed ("Flow Speed", float) = 0.05