Skip to content

Instantly share code, notes, and snippets.

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

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / gaze-target-check-interface.cs
Created January 14, 2017 15:56
Check if Gvr target implements interface (cardboard reticle)
// GvrReticlePointer.cs (or custom version of it)
public override void OnPointerEnter(GameObject targetObject, Vector3 intersectionPosition, Ray intersectionRay, bool isInteractive)
{
// IGazeTarget is the interface
bool isGazeTarget = ExecuteEvents.GetEventHandler<IGazeTarget>(targetObject) != null;
@unitycoder
unitycoder / data-text
Created January 3, 2017 10:13
data-text-html uri
javascript:window.location.assign("data:text/html, http://www.facebook.com/ <script>alert('trap');<\/script>");

Minecraft Ultimate Tool Set

Requires creative mode or operator power on a multiplayer server. On a single player game (survival or hardcore), you will need "cheats" enabled to move into creative mode. Don't forget to leave creative mode when done.

These items might be stupid. Be prepared to repair the country-side.

@unitycoder
unitycoder / bugs.txt
Created December 27, 2016 03:06
Bugs
UI
- adjusting ui element scale (like text), causes problem with drawing order? (whole canvas gets drawn behind regular mesh for some reason)
@unitycoder
unitycoder / shader-unpack-float.shader
Last active January 20, 2019 12:46
Unpack 2 numbers from Float
// source https://www.youtube.com/watch?v=1ZPcXcCBFIs
float2 Unpack(float v)
{
return float2(floor(v),frac(v)*4096.0);
}
float2 unpackedval = Unpack(uv2.x);
@unitycoder
unitycoder / sorting-order.cs
Created December 14, 2016 02:31
Draw Mesh above World Space Canvas
// Draw mesh above world space Canvas (that has drawing order > 0 )
GetComponent<Renderer>().sortingOrder = 99;
@unitycoder
unitycoder / CameraShake.cs
Created December 10, 2016 16:39
CameraShake
using UnityEngine;
using System.Collections;
public class CameraShake : MonoBehaviour
{
public bool shakePosition;
public bool shakeRotation;
public float shakeIntensityMin = 0.1f;
public float shakeIntensityMax = 0.5f;
@unitycoder
unitycoder / GridMove.cs
Created December 10, 2016 06:07
Grid Movement Step By Step (IEnumerator)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GridMove : MonoBehaviour
{
public AnimationCurve movementCurve = new AnimationCurve();
public float moveDuration = 1f;
Vector3 dir = Vector3.zero;
@unitycoder
unitycoder / CustomBlockCopy.cs
Created November 23, 2016 04:23
Array Copy CustomBlockCopy
// unsafe blockcopy from byte to short array
// https://forum.unity3d.com/threads/blockcopy-on-net-native-toolchain.442287/#post-2860800
public unsafe static void CustomBlockCopy( byte[] src , short[,] dst , int count )
{
fixed( byte* pSrc = src )
{
fixed( short* pDst = dst )
{
// Copy 64-bit blocks
@unitycoder
unitycoder / Install-Update-Spigot.txt
Last active June 7, 2022 20:56
Install & Update Spigot Minecraft
// install
> yum install java-1.8.0-openjdk
> yum install screen
> mkdir minecraft
> cd minecraft
> wget -O BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
> yum install git
> git config --global --unset core.autocrlf
> java -jar BuildTools.jar
~~run> java -Xms512M -Xmx1G -XX:+UseConcMarkSweepGC -jar spigot-1.11.2.jar~~