Skip to content

Instantly share code, notes, and snippets.

@tvogt
tvogt / gist:65bb6827a67d745fd88f4f30ce67a0bd
Created June 18, 2025 07:49
Unity UI Toolkit reset USS
/*
Unity's default theme includes colour and other elements going beyond mere basic formats
that are required if you want to use, say, ListViews or columns. Unfortunately, due to the specificity rule,
these will take precendence over your own styles. e.g. the .unity-button:hover:enabled will squash your
definition of .myButton:hover because it is considered "more specific".
This USS is a "reset" USS that clears those settings. You can simply include it as another stylesheet in your theme,
preferably the first (so it is overwritten by your own styles)
This is still INCOMPLETE. I add to it whenever I find something else that messes up my styling.
@tvogt
tvogt / BuoyController.cs
Created December 17, 2023 11:00
A very simple buoyancy script for Unity and the Poseidon water system - easily adapted to other water systems, all you need is a method to get the water height (including waves) at a world-space position.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pinwheel.Poseidon;
/*
Simple Buoyancy Script for Poseidon water system
to adapt to any other water system, just edit the GetWaterHeight() method to whatever your water system uses to get the wave/water height of a given point
the container should sit at the center of the ship for best effect
*/