Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@ToastHelmi
ToastHelmi / Drag.cs
Last active March 31, 2016 06:12
Add Drag to Boat
public void AddDrag(float area, Vector3 crossProduct, Vector3 centerPoint)
{
if (boatRB.velocity != Vector3.zero)
{
var angle = Vector3.Angle(crossProduct, boatRB.velocity);
if(angle> -90 && angle < 90)
{
angle = Mathf.Abs(angle);
var areaFactor = Mathf.Clamp(angle, 1, 0);
float dragForce = boatRB.velocity.magnitude * boatRB.velocity.magnitude;
@shaunsales
shaunsales / ExampleClass.cs
Last active January 20, 2016 09:38
Example Unity Class - How to format your code.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ExampleClass : MonoBehaviour // Try to name classes so other developers can infer their functionality. Abstract classes are prefixed with 'Base'
{
private enum WidgetType // Enums should end in 'Type' and can be inlined with the class if private, but generally should be relocated if public
{
None,
Circle,
@DashW
DashW / ScreenRecorder.cs
Last active November 12, 2025 14:51
ScreenRecorder - High Performance Unity Video Capture Script
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
class BitmapEncoder
{
public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData)
@subfuzion
subfuzion / curl.md
Last active April 20, 2026 11:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@DGoodayle
DGoodayle / VectorRangeAttribute.cs
Last active October 13, 2022 21:18
Limit a Vector2 within a certain range like a boss.
using UnityEngine;
using UnityEditor;
/*
Vector Range Attribute by Just a Pixel (Danny Goodayle @DGoodayle) - http://www.justapixel.co.uk
Copyright (c) 2015
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
@xanathar
xanathar / Easing.cs
Created March 17, 2016 23:54
Robert Penner's easing equations for Unity
/**
* Easing
* Animates the value of a float property between two target values using
* Robert Penner's easing equations for interpolation over a specified Duration.
*
* Original Author: Darren David darren-code@lookorfeel.com
*
* Ported to be easily used in Unity by Marco Mastropaolo
*
* Credit/Thanks:
Shader "Name" {
Properties {
name ("display name", Range (min, max)) = number
name ("display name", Float) = number
name ("display name", Int) = number
name ("display name", Color) = (number,number,number,number)
name ("display name", Vector) = (number,number,number,number)
@alirobe
alirobe / reclaimWindows10.ps1
Last active April 15, 2026 11:59
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
###
###
### UPDATE: For Win 11, I recommend using this tool in place of this script:
### https://christitus.com/windows-tool/
### https://github.com/ChrisTitusTech/winutil
### https://www.youtube.com/watch?v=6UQZ5oQg8XA
### iwr -useb https://christitus.com/win | iex
###
### OR take a look at
### https://github.com/HotCakeX/Harden-Windows-Security
@darkguy2008
darkguy2008 / UDPSocket.cs
Last active December 19, 2025 07:51
Simple C# UDP server/client in 56 lines
using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace UDP
{
public class UDPSocket
{
private Socket _socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
@MattRix
MattRix / UnityEditorIcons.txt
Last active April 26, 2026 06:04
A list of all the built-in EdtiorGUI icons in Unity. Use EditorGUIUtility.IconContent([icon name]) to access them.
ScriptableObject Icon
_Popup
_Help
Clipboard
SocialNetworks.UDNOpen
SocialNetworks.Tweet
SocialNetworks.FacebookShare
SocialNetworks.LinkedInShare
SocialNetworks.UDNLogo
animationvisibilitytoggleoff