Skip to content

Instantly share code, notes, and snippets.

View Sithdown's full-sized avatar

Sithdown Sithdown

  • GRUP MEDIAPRO
  • Málaga, Spain
  • 08:27 (UTC +02:00)
View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / NetworkingTools.cs
Last active April 28, 2023 09:49
Since Unity 2018.3 we've had this cool new tool called [SettingsProvider] that we can use to add custom settings menu into Unitys settings screens. This short example shows how i use [SettingsProvider] and some [MenuItems] to help build and run test clients when im developing a multiplayer game. My usecase is that i want a quick way to build and…
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using UnityEditor.Build.Reporting;
using UnityEngine;
using Debug = UnityEngine.Debug;
public static class NetworkingTools
{
@gekidoslair
gekidoslair / ResetParentTransform.cs
Created November 10, 2019 01:07
Quick utility to reset a parent GameObject position to 0,0,0 without screwing up the child positions
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
namespace MWU.Shared.Utilities
{
public static class ResetParentTransform
{
[MenuItem("Tools/Edit/Reset Parent Transform %_r")]
public static void DistributeObjectsEvenly()
@LotteMakesStuff
LotteMakesStuff / LookatTool.cs
Last active November 2, 2023 21:04
In Unity 2019.1 Unity added a new custom EditorTool API, heres some example code showing some tools we could make with it!
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;
[EditorTool("LookAt Tool")]
public class LookatTool : EditorTool
{
GUIContent cachedIcon;
// NOTE: as were caching this, unity will serialize it between compiles! so if we want to test out new looks,
Shader "Custom/Grass Geometry Shader" {
Properties{
[NoScaleOffset] _MainTex("Grass A", 2D) = "white" {}
[NoScaleOffset] _GrassTwo("Grass B", 2D) = "white" {}
_Splat("Splat", 2D) = "white" {}
_Cutoff("Cutoff", Range(0,1)) = 0.25
Shader "Custom/SilhouetteShader"
{
Properties
{
_SilhouetteColor("Silhouette Color", Color) = (0,1,0,1)
}
SubShader
{
Tags{"Queue"="Geometry+1" "RenderType" = "Geometry"}
@rngtm
rngtm / TriangleNode.cs
Last active February 8, 2024 03:19
正三角形タイルを出力するShaderGraphカスタムノード (Unity2021ver : https://gist.github.com/rngtm/2ce62f55c4e80bdf5570402bd4d66dc7)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.ShaderGraph;
using System.Reflection;
[Title("Distance", "Triangle")]
public class TriangleNode : CodeFunctionNode
{
public TriangleNode()
@sabresaurus
sabresaurus / ConsoleCallStackHelper.cs
Last active May 2, 2020 09:56
Jump to file/line in the Unity console window callstack via this helper window
// MIT License
//
// Copyright (c) 2018 Sabresaurus
//
// 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:
@LotteMakesStuff
LotteMakesStuff / 1.md
Last active January 2, 2025 21:54
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@n0mimono
n0mimono / YouTubeLiveController.cs
Created February 12, 2018 06:10
Unity script example for YouTube Live Streaming API
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System;
using System.Net;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.Networking;
using SimpleJSON;
@munkbusiness
munkbusiness / Vibration.cs
Last active January 28, 2025 11:54
Vibration for Unity3d with Android native Call that supports both the new vibrationEffectClass and the old simple vibrate, with fallback to Handlheld.Vibrate().
using UnityEngine;
using System.Collections;
public class Vibration : MonoBehaviour {
public static AndroidJavaClass unityPlayer;
public static AndroidJavaObject vibrator;
public static AndroidJavaObject currentActivity;
public static AndroidJavaClass vibrationEffectClass;
public static int defaultAmplitude;