Skip to content

Instantly share code, notes, and snippets.

@nikescar1
nikescar1 / ImagePhysicsShapeRaycasting.cs
Created September 23, 2022 00:02
UI Image using Sprite Physics Shape for canvas raycasting
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ImagePhysicsShapeRaycasting : Image, ICanvasRaycastFilter, ISerializationCallbackReceiver, ILayoutElement
{
private List<Vector2> physicsShape = new List<Vector2>();
new void Start()
{
@nikescar1
nikescar1 / CoroutineTesting.cs
Last active September 8, 2022 22:44
Scheduling Coroutines
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class CoroutineTesting : MonoBehaviour
{
public class CoroutineGroup
{
public class CoroutineWithFinish
@nikescar1
nikescar1 / PostBuildRunScript.cs
Last active October 8, 2022 16:53
Auto Upload build to Steam Deck from Unity build
// Wes Jurica - 2022
// This is free and unencumbered software released into the public domain.
// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.
// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
@nikescar1
nikescar1 / TMP_InputField.cs
Created June 9, 2022 05:41
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;
@nikescar1
nikescar1 / NumberStringsTesting
Created October 18, 2021 21:20
Example of setting TextMeshPro text every frame without allocations
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class NumberStringsTesting : MonoBehaviour
{
public List<TMP_Text> digits; //Add these in reverse order (Highest digit first, lowest digit last)
List<int> numbers = new List<int>(50);
@nikescar1
nikescar1 / Program.cs
Created February 6, 2021 08:26
FindingPrimes C# Console Program
using System;
using System.Collections.Generic;
namespace FindingPrimes
{
class Program
{
static void Main(string[] args)
{
int runs = 10;