Skip to content

Instantly share code, notes, and snippets.

View TobiasPott's full-sized avatar

Tobias TobiasPott

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tobiaspott on github.
  • I am topo (https://keybase.io/topo) on keybase.
  • I have a public key ASDLCRTkO7U0eWrjHTFT-qXxfK4RLHpf-IZXee7YorXJ6Qo

To claim this, I am signing this object:

@TobiasPott
TobiasPott / CameraGrab.cs
Last active June 10, 2022 13:54
Unity3D ScreenGrab class for non-blocking camera capturing
using System;
using System.Collections;
using UnityEngine;
namespace NoXP
{
/// <summary>
/// list of texture format encodings currently available in Unity3D (at runtime)
/// </summary>
public enum TextureEncodings
@TobiasPott
TobiasPott / Coroutiner.cs
Last active September 23, 2019 12:57
Helper class to execute Unity3D Coroutines without an explicit MonoBehaviour reference
using System.Collections;
#if NET_4_6 || NET_STANDARD_2_0
using System.Threading.Tasks;
#endif
using UnityEngine;
public class Coroutiner : MonoBehaviour
{
@TobiasPott
TobiasPott / NestedContentSizeFitter.cs
Last active December 12, 2023 09:19
A helper class/re-implementation of ContentSizeFitter to utilise a referenced transform for automatic sizing operations
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.UI;
#endif
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace VRTX.UI
/* This wizard will replace a selection with an object or prefab.
* Scene objects will be cloned (destroying their prefab links).
* Original coding by 'yesfish', nabbed from Unity Forums
* 'keep parent' added by Dave A (also removed 'rotation' option, using localRotation
* 2020/03/04 (Tobias Pott): Updated code for use in Unity 2019.x and fixed problems with Undo/Redo insertion
*/
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
echo off
if [%1]==[] (
echo No path given as parameter
exit /b
) else (
set basePath=%1
set imPath="C:\Program Files\ImageMagick\7.0.10-Q16-HDRI\magick.exe"
)
echo off
if [%1]==[] (
echo No path given as parameter
exit /b
) else (
set basePath=%1
)
REM Optional second parameter to point to ImageMagick executable
@TobiasPott
TobiasPott / setup-swapfile.sh
Created September 19, 2020 09:49
Swapfile Auto-Setup (for Jetson Nano)
echo Setup Swap File (4GB)
swapon --show
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo /swapfile swap swap defaults 0 0 >> /etc/fstab
swapon --show
@TobiasPott
TobiasPott / AutoFitGridLayout.cs
Last active March 30, 2021 09:45
A simple auto fit component extending the GridLayoutGroup to automatically fit all children inside of it based on the grid layout orientation.
using UnityEngine;
using UnityEngine.UI;
namespace NoXP
{
[ExecuteAlways()]
[RequireComponent(typeof(GridLayoutGroup))]
public class AutoFitGridLayout : MonoBehaviour
{
private RectTransform _rectTransform = null;
@TobiasPott
TobiasPott / propcached.snippet
Created June 24, 2021 07:57
Visual Studio Custom Unity Code Snippets
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>propcached</Title>
<Shortcut>propcached</Shortcut>
<Description>Code snippet for a cached property and backing field in Unity behaviour code</Description>
<Author>Tobias Pott</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>