Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / old-assetstore.js
Last active February 20, 2026 18:09
GreaseMonkey: Stay in Old Unity Asset Store
// ==UserScript==
// @name Force Old Unity Asset Store
// @version 2
// @include https://www.assetstore.unity3d.com/#!/content/*
// @include https://assetstore.unity.com/packages/*
// @run-at document-start
// @grant none
// ==/UserScript==
// https://unitycoder.com/blog/2018/09/23/browser-plugin-stay-in-old-asset-store/
@unitycoder
unitycoder / CloudBuildHelper.cs
Created September 21, 2018 14:04
Get Cloudbuild Version Number Inside App
// https://forum.unity.com/threads/get-unity-cloud-version-number-on-game-run-time.558475/#post-3702130
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
public class CloudBuildHelper : MonoBehaviour
{
#if UNITY_CLOUD_BUILD
public static void PreExport(UnityEngine.CloudBuild.BuildManifestObject manifest)
{
@unitycoder
unitycoder / string-format.cs
Created September 21, 2018 13:04
string format float to 2 decimals
"123.345345".ToString("0.0#") // 123.34
@unitycoder
unitycoder / mouse-over-ui-element.cs
Last active May 3, 2023 10:18
Check if mouse is over UI element
if (eventSystem.IsPointerOverGameObject()) return;
if (eventSystem.currentSelectedGameObject != null) return;
// this works with Oculus vr also:
if (EventSystem.current.IsPointerOverGameObject()) return;
if (EventSystem.current.currentSelectedGameObject != null) return;
@unitycoder
unitycoder / Texture2DArraySurface.Shader
Created September 18, 2018 06:12
GPU Instancing + Texture2DArray
Shader "Custom/Texture2DArraySurfaceShader"
{
Properties
{
_Textures("Textures", 2DArray) = "" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
@unitycoder
unitycoder / install.sh
Created September 12, 2018 09:41
node version manager bash script
#!/usr/bin/env bash
# back up from original source: https://github.com/creationix/nvm/blob/master/install.sh
# usage to install specific node version:
# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
# - . ~/.nvm/nvm.sh
# - nvm install 4.6.1
{ # this ensures the entire script is downloaded #
nvm_has() {
type "$1" > /dev/null 2>&1
@unitycoder
unitycoder / win10-msn-popup-browser.txt
Created September 12, 2018 02:34
Windows 10 opens msn.com webpage at startup
https://answers.microsoft.com/en-us/windows/forum/windows_10-other_settings/web-browser-keeps-opening-to-msn-by-itself/192def23-0180-4812-bcea-654c502c9928
I think I know the cause of this:
If you're connected to a wireless network that has a web-based login portal (whether you type a login/password, or just click agree to the terms and conditions, they're both the same) while you're also connected to a wired, then that is probably the cause, and your workaround is to disconnect to that wireless network (or alternatively, just log in.)
Edit: or do this: https://stackoverflow.com/questions/43491861/how-to-disable-automatically-browser-opening-on-wi-fi-hotspot-connection-for-win
Explanation: Windows 10 has a new behavior to correct Windows 7's worse behavior of frequently prioritizing wireless connections over wired connections, while you're connected to both, and getting the interface metrics all wrong. Windows 10 prioritizes wired always, meanwhile it also has a feature so that if it detects a wireless netw
@unitycoder
unitycoder / LightweightPipelineTemplateShader.shader
Created September 11, 2018 12:09 — forked from phi-lira/UniversalPipelineTemplateShader.shader
Template shader to use as guide to create Lightweight Pipeline ready shaders.
// When creating shaders for Lightweight Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this simplified version as a base.
// Please not this should be only use for reference only.
// It doesn't match neither performance not feature completeness of Lightweight Pipeline Standard shader.
Shader "LightweightPipeline/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@unitycoder
unitycoder / Red Green Refactor.txt
Last active January 20, 2019 12:47
Red Green Refactor - test driven method
RED: write a test before any code makes it pass (check to see what the error message is, make sure its descriptive and meaningful)
GREEN: as fast as you can, write any/meaningful code that makes the test pass!
REFACTOR: refactor the code to be more efficient and readable while maintaining passing state
// https://www.twitch.tv/automateallthethings
@unitycoder
unitycoder / hijack-back-button.js
Created August 29, 2018 06:31
Back button hijack - javascript
<script>
// https://dejanseo.com.au/competitor-hack/
JQuery(document).ready(function($) {
if (window.history && window.history.pushState)
{
window.history.pushState('forward', null, './');
$(window).on('popstate', function()
{
var ref = document.referrer;
if (ref!='')