Skip to content

Instantly share code, notes, and snippets.

@Scraft
Scraft / Test.cpp
Created October 18, 2017 11:44
Example of overriding send/receive with netcode.io
/*
netcode.io reference implementation
Copyright © 2017, The Network Protocol Company, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
@apkd
apkd / Comment.cs
Last active August 3, 2023 20:01
Double-click the text area to edit. https://tryfinally.dev/unity-comment-component
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Callbacks;
#endif
using System;
using System.Linq;
using UnityEngine;
using S = UnityEngine.SerializeField;
/// <summary>
@ryanc-unity
ryanc-unity / AsyncBundleLoader.cs
Last active August 22, 2022 14:55
Dummy object generator for project testing
using System.Collections;
using System.IO;
using UnityEngine;
public class AsyncBundleLoader : MonoBehaviour
{
// Used for visual debugging as to not generate unnecessary allocations
public GameObject worldLight;
// Private fields to keep track of loaded objects
@ByronMayne
ByronMayne / Point
Last active May 5, 2018 16:01
A int version of a Vector2 in Unity. Supports explicit conversion between the two types as well as a few helpful helper functions. The second script is a property drawer that supports panning of values and right clicking to reset the value to zero (taking from 3Ds Max).
using UnityEngine;
using System;
[Serializable]
public struct Point
{
[SerializeField]
public int x;
[SerializeField]
public int y;

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@Farfarer
Farfarer / Cable.cs
Created July 5, 2016 15:45
Catenary curves in Unity. Creates a catenary curve between two points with a given amount of slack. http://farfarer.com/temp/unity_cables.png
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.EventSystems;
[System.Serializable]
public class CableCurve {
[SerializeField]
Vector3 m_start;
/*
* Author: David Robert Nadeau
* Site: http://NadeauSoftware.com/
* License: Creative Commons Attribution 3.0 Unported License
* http://creativecommons.org/licenses/by/3.0/deed.en_US
*/
#if defined(_WIN32)
#include <Windows.h>
#elif defined(__unix__) || defined(__unix) || defined(unix) || (defined(__APPLE__) && defined(__MACH__))
@StagPoint
StagPoint / QuaternionCompression.cs
Last active December 2, 2024 07:38
C# - Use "smallest three" compression for transmitting Quaternion rotations in Unity's UNET networking, from 16 bytes to 7 bytes.
// Copyright (c) 2016 StagPoint Software
namespace StagPoint.Networking
{
using System;
using UnityEngine;
using UnityEngine.Networking;
/// <summary>
/// Provides some commonly-used functions for transferring compressed data over the network using
@dentedpixel
dentedpixel / LeanTween Spline Performant
Created March 4, 2016 16:23
An example of showing how to do a LeanTwee.moveSpline with better performance.
using UnityEngine;
using System.Collections;
public class EngineStressTest1 : MonoBehaviour {
private int animateCount = 6000;
private GameObject[] cubes;
private LTSpline[] splines;
@maccesch
maccesch / iTween.cs
Last active June 30, 2020 03:48
Unity3D iTween patched to work in the new Unity GUI (uGUI).
// Copyright (c) 2011 Bob Berkebile (pixelplacment)
// Please direct any bugs/comments/suggestions to http://pixelplacement.com
//
// 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:
//