Skip to content

Instantly share code, notes, and snippets.

View Josef212's full-sized avatar
:shipit:
Subidapdap

Josef21296 Josef212

:shipit:
Subidapdap
View GitHub Profile
@Josef212
Josef212 / cloudSettings
Last active June 15, 2018 10:49
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-06-07T12:10:26.928Z","extensionVersion":"v2.9.2"}
git reflog
git cherry-pick [commit id or short code] => copies a commit into current head
@Josef212
Josef212 / CameraMovement.cs
Last active March 16, 2019 15:26
Unity camera movement
using UnityEngine;
public class CameraMovement : MonoBehaviour
{
void Update()
{
float movSpeed = m_cameraMovementSpeed;
float rotSpeed = m_cameraRotationSpeed;
if(Input.GetKey(KeyCode.LeftShift))
@Josef212
Josef212 / RectTransformExtensions.cs
Last active January 2, 2023 17:48
Unity RecTransform extensions to set Left, Right, Top and Bottom.
/**
MIT License
Copyright (c) 2022 Josef21296
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
@Josef212
Josef212 / NesteScrollRect.cs
Last active July 12, 2024 09:38
A nested ScrollRect for unity
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class NestedScrollRect : ScrollRect
{
public override void OnInitializePotentialDrag(PointerEventData eventData)
{
for(int i = 0; i < m_parentInitializePotentialDragHandlers.Length; ++i)
{
public static class Extensions
{
public static string TrimDouble(this string temp)
{
var value = temp.IndexOf('.') == -1 ? temp : temp.TrimEnd('.', '0');
return value == string.Empty ? "0" : value;
}
}
using UnityEngine;
using UnityEngine.EventSystems;
public class SensitiveInteractuables : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public void OnPointerDown(PointerEventData eventData)
{
m_initialDragThreshold = EventSystem.current.pixelDragThreshold;
EventSystem.current.pixelDragThreshold = m_newTreshold;
}
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class EmptyGraphics : Graphic
{
protected override void OnPopulateMesh(VertexHelper vh)
{
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
public class CompileTime
{
private const string RELOAD_TIME_KEY = "AssemblyReloadEventsTime";
private const string COMPILATION_TIME_KEY = "CompileStartTime";
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("#Assembly.Name")]