Skip to content

Instantly share code, notes, and snippets.

View Biodam's full-sized avatar
🕹️
Making games

Fábio Damian Biodam

🕹️
Making games
View GitHub Profile
@Fewes
Fewes / Tricubic.cginc
Last active May 7, 2024 07:16
Tricubic texture sampling using 8 trilinear samples
#ifndef TRICUBIC_INCLUDED
#define TRICUBIC_INCLUDED
float4 Cubic(float v)
{
float4 n = float4(1.0, 2.0, 3.0, 4.0) - v;
float4 s = n * n * n;
float x = s.x;
float y = s.y - 4.0 * s.x;
float z = s.z - 4.0 * s.y + 6.0 * s.x;
@sinbad
sinbad / SpriteMeshRaycastFilter.cs
Last active May 11, 2023 05:35
SpriteMeshRaycastFilter: easy Unity UI non-rectangular click detector without reading textures
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// Restrict raycasting to a sprite mesh shape
// Could use Image.alphaHitTestMinimumThreshold to mask but that requires read/write images which can't be packed
[RequireComponent(typeof(Image))]
public class SpriteMeshRaycastFilter : MonoBehaviour, ICanvasRaycastFilter {
private RectTransform rectTransform;
@Fscibe
Fscibe / LocIDAttribute.cs
Created October 5, 2019 07:48
Drop-down Term selector for Unity I2 Localization
using UnityEngine;
/// <summary>
/// Custom attribute to display a drop-down list containing localized Terms.
///
/// Usage:
///
/// class Foo : ScriptableObject
/// {
/// [LocID]
@JanHalozan
JanHalozan / ShieldShader
Created January 25, 2019 16:37
ShieldShader.shader
Shader "ShieldShader"
{
Properties
{
_Globalopacity("Global opacity", Range( 0 , 1)) = 1
_Maintexture("Main texture", 2D) = "black" {}
_Maintextureintensity("Main texture intensity", Float) = 1
_Mainpanningspeed("Main panning speed", Vector) = (0,0,0,0)
[Toggle]_Invertmaintexture("Invert main texture", Range( 0 , 1)) = 0
[HDR]_Maincolor("Main color", Color) = (0.7941176,0.1284602,0.1284602,0.666)
@JohannesMP
JohannesMP / LICENSE
Last active March 9, 2024 11:26
[Unity3D] A Reliable, user-friendly way to reference SceneAssets by script.
/*******************************************************************************
* Don't Be a Jerk: The Open Source Software License.
* Adapted from: https://github.com/evantahler/Dont-be-a-Jerk
*******************************************************************************
* _I_ am the software author - JohannesMP on Github.
* _You_ are the user of this software. You might be a _we_, and that's OK!
*
* This is free, open source software. I will never charge you to use,
* license, or obtain this software. Doing so would make me a jerk.
*
@Valeour
Valeour / PreferencesWindow.cs
Last active September 8, 2018 15:23
Open Unity Preferences Window with Section
/**
* PreferenceWindow helper created by Chance Millar at Two Tails Games on 2018/07/24
* Use freely. That's a license, right?
*
* Be sure to place in an Editor folder inside Assets.
*/
using System;
using System.Collections;
using System.Reflection;
@reneabreu
reneabreu / AutoHideSplashScreen.cs
Last active December 16, 2022 12:17
I always forget to check if Unity's splashscreen is activated, so here is a Pre-Process Build to check if i'm using Unity Plus/Pro and deactivate it for me.
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using UnityEditor.Build;
#if UNITY_2017
class AutoHideSplashScreen : IPreprocessBuild
{
public int callbackOrder { get { return 0; } }
public void OnPreprocessBuild(BuildTarget target, string path) {
@yagero
yagero / EventSystemManaged.cs
Created November 7, 2017 10:14
EventSystemManaged
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class EventSystemManaged : EventSystem
{
static Stack<EventSystem> ms_PrevEventSystem = new Stack<EventSystem>();
static bool ms_Forced = false;
protected override void OnEnable()
@darktable
darktable / MiniJSON.cs
Created November 30, 2011 23:08
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining