Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / StarField.cs
Created May 11, 2025 11:36 — forked from silverua/StarField.cs
Script for StarField background in Unity from this tutorial: https://www.youtube.com/watch?v=yu23OAd_Wrw&list=LL
using UnityEngine;
using Random = UnityEngine.Random;
public class StarField : MonoBehaviour
{
private Transform thisTransform;
private ParticleSystem.Particle[] points;
public int starsMax = 100;
public float starSize = 1f;
// From: https://answers.unity.com/questions/801928/46-ui-making-a-button-transparent.html?childToView=851816
//
// @kurtdekker
//
// Touchable invisible non-drawing Graphic (usable with Buttons too):
//
// To make an invisible Button:
//
// 1. make a Button in the normal way
// 2. delete the "Text" GameObject which comes below a Button as standard
@unitycoder
unitycoder / CppBuildPreprocessing.cs
Created April 17, 2025 12:56 — forked from yCatDev/CppBuildPreprocessing.cs
Script that enables Full Generic Sharing by default for all builds for Unity 2021
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
public class CppBuildPreprocessing : IPreprocessBuildWithReport
{
public int callbackOrder
{
get { return 0; }
@unitycoder
unitycoder / InspectorLock.cs
Created April 13, 2025 18:15 — forked from adammyhre/InspectorLock.cs
Lock Inspector Icon and Transform Constrain Proportion Icon in Unity
using System.Reflection;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Toggles the Inspector lock state and the Constrain Proportions lock state.
/// </summary>
public static class LockInspector {
static readonly MethodInfo flipLocked;
static readonly PropertyInfo constrainProportions;
@unitycoder
unitycoder / HeatmapCompute.compute
Created April 13, 2025 18:14 — forked from adammyhre/HeatmapCompute.compute
Compute Shader + Render Feature Heatmap
#pragma kernel CSMain
RWTexture2D<float> heatmapTexture;
float2 texSize;
StructuredBuffer<float2> enemyPositions;
int enemyCount;
[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)

How to use GitHub releases as markdown image storage

I often uploaded images to GitHub issues and used their URLs in markdown files (such as README.md).
This method was convenient since it didn’t require adding the images to the repository, and each image had a unique URL.
However, in (probably) March 2025, GitHub changed their policy so that accessing images uploaded to issues now requires cookie-based authentication.
This applies even to images uploaded to issues in public repositories.

As a result, the benefit of 'anyone who knows the URL can access the image' has been lost.

@unitycoder
unitycoder / DamageNumberSpawner.cs
Created March 2, 2025 15:10 — forked from adammyhre/DamageNumberSpawner.cs
World Space UI Toolkit
using PrimeTween;
using UnityEngine;
using UnityEngine.Pool;
using UnityUtils;
public class DamageNumberSpawner : MonoBehaviour {
[SerializeField] WorldSpaceUIDocument uiDocumentPrefab;
[SerializeField] float positionRandomness = 0.2f;
IObjectPool<WorldSpaceUIDocument> uiDocumentPool;
@unitycoder
unitycoder / VideoSupportPlugin.java
Created February 21, 2025 09:43 — forked from asus4/VideoSupportPlugin.java
Check supported resolution from unity
package asus4.videosupportedplugin;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
/**
* Created by ibu on 2017/03/12.
*/
public final class VideoSupportedPlugin {
@unitycoder
unitycoder / TMP_InputField.cs
Created February 13, 2025 07:39 — forked from nikescar1/TMP_InputField.cs
Since TMP_InputField is essentially unusable with gamepad and keyboard navigation, I upgraded them to work better (don't start editing on select and added OnFocus event)
//#define TMP_DEBUG_MODE
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Text;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;
@unitycoder
unitycoder / TransformEditor.cs
Created February 12, 2025 12:54 — forked from GhatSmith/TransformEditor.cs
Custom inspector for Transform component. Add buttons to reset, copy, paste Transform values. Add context menu to round or truncate values.
using UnityEngine;
using UnityEditor;
namespace OddTales.Framework.Core.EditorExtension
{
/// <summary>
/// Custom inspector for Transform component. Using only DrawDefaultInspector would give different display.
/// Script based on Unity wiki implementation : https://wiki.unity3d.com/index.php/TransformInspector
/// Buttons to reset, copy, paste Transform values.