Skip to content

Instantly share code, notes, and snippets.

View TobiasPott's full-sized avatar

Tobias TobiasPott

View GitHub Profile
@TobiasPott
TobiasPott / PrivacyPolicy-BrickArtInstructor.txt
Created December 15, 2023 19:55
Privacy Policy for Brick Art Instructor
Brick Art Instructor does not collect any data.
Thus no data is shared or given to anyone.
@TobiasPott
TobiasPott / SubselectionDrawer.cs
Last active August 25, 2023 22:15
An property drawer to allow selecting from a list of component types on the current selected instance based on type or type inheritance hierarchy
using System;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngineExtensions
{
@TobiasPott
TobiasPott / SubComponentAttribute.cs
Created August 25, 2023 21:32
An property drawer to allow selecting from a list of component types on the current selected instance
using System;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace UnityEngineExtensions
{
@TobiasPott
TobiasPott / SelectionExtensions.cs
Created October 25, 2022 11:29
Extension to allow shortcut-based save and load of selection to disk (.sel files)
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SelectionExtensions
@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>
@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 / 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
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
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"
)
/* 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;