Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / Unity Pixel Art Tilemap Issues.md
Last active May 2, 2024 23:57
Unity Pixel Art Tilemap Issues Gaps Lines Tearing

lines between tiles, tilemap gaps:

@unitycoder
unitycoder / CustomImportProcessor.cs
Created February 27, 2023 07:02
Read FBX Custom Properties (Unity Editor Script AssetPostprocessor)
// https://forum.unity.com/threads/how-to-import-user-defined-attributes-from-fbx-files.409877/
using UnityEngine;
using UnityEditor;
using System.IO;
class CustomImportProcessor : AssetPostprocessor {
void OnPostprocessGameObjectWithUserProperties(GameObject go, string[] names, System.Object[] values) {
ModelImporter importer = (ModelImporter)assetImporter;
var asset_name = Path.GetFileName(importer.assetPath);
Debug.LogFormat("OnPostprocessGameObjectWithUserProperties(go = {0}) asset = {1}", go.name, asset_name);
@unitycoder
unitycoder / HighscoreFetch.php
Last active May 2, 2024 18:42
PHP top 10 highscore script (save name and score)
<?php
// Replace with your own database credentials
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "highscores";
try {
// Create a new PDO connection
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
@unitycoder
unitycoder / xr-interaction-toolkit.md
Last active May 2, 2024 11:36
Unity XR Interaction Toolkit Notes

xr ray interactor, hover and trigger select on box

  • from Ray Interactor, check raycast configuration layers (where it hits)
  • on the target object, add xr simple interactable, add event targets for hover/select
  • use args: HoverEnterEventArgs, HoverExitEventArgs, SelectEnterEventArgs.. to received data
  • public void OnHoverEnter(HoverEnterEventArgs args)
  • Debug.Log($"{args.interactorObject} hovered over {args.interactableObject}", this);

Adding custom InputAction for reading PrimaryButtonA

  • edit XRI Default Input Actions (from xr interaction started samples)
@unitycoder
unitycoder / teams-ux-notes.md
Last active May 2, 2024 10:49
Whats Wrong With Microsoft Teams - UX

Whats Wrong With Microsoft Teams

*(not in any order, and i know few of these have been fixed, like having conference in separate window) **These are mostly from Classic version, will collect New Teams specific in the gist below

Chat

  • If you typed message in some chat, then alt tab and go to another chat, that message is still in the chatbox (wrong room)
  • if there is many single messages, with link on each, tooltip emoji menu popups and blocks your view to previews item (and you can accidentally click it if tried to click the previous link)
  • if paste image to messagebox, messagebox stays very small 2 rows.. so cannot see anything (or wait, it expands after you alt tab away..)
  • channel mention doesnt show alerts for people by default
  • replies minimize automatically if leave chat open for a while (so context is lost where you left it)
@unitycoder
unitycoder / DrawBounds.cs
Last active May 1, 2024 15:49
Draw Bounds with Debug.DrawLine , Draw Box, Draw Runtime Gizmos
void DrawBounds(Bounds b, float delay=0)
{
// bottom
var p1 = new Vector3(b.min.x, b.min.y, b.min.z);
var p2 = new Vector3(b.max.x, b.min.y, b.min.z);
var p3 = new Vector3(b.max.x, b.min.y, b.max.z);
var p4 = new Vector3(b.min.x, b.min.y, b.max.z);
Debug.DrawLine(p1, p2, Color.blue, delay);
Debug.DrawLine(p2, p3, Color.red, delay);
@unitycoder
unitycoder / android-errors.txt
Last active April 29, 2024 19:32
Unity Android Build Errors
### "error while evaluating property namespace of task unitylibrary:googleplaygamesmanifest.androidlib:packageReleaseResources'
Delete "Assets\Plugins\Android\GooglePlayGamesManifest.androidlib" folder before build (every time)
### get your app id from google play console (for leaderboards plugin)
- On the left menu, Play Games Services/Setup and management/Configuration (but its only available, if you have done play services setup for this app)
### GRADLE ERROR : colliding-attributes
- https://gley.gitbook.io/easy-achievements/setup-guide#build
### stuck at "building scene 0"
@unitycoder
unitycoder / ReelBack.cs
Created April 29, 2024 04:47
Reel Line made from points back
// https://forum.unity.com/threads/coding-a-2d-extendable-and-retractable-fishline.1586673/#post-9801981
private void ReelBack(List<Vector3> points, float reelValue)
{
    if (reelValue <= 0)
        return;
 
    Vector3 origin = points[0];
    float reel = reelValue;
 
    // find cut point
@unitycoder
unitycoder / Image.md
Last active April 29, 2024 02:30
GreaseMonkey script to display unity api version first added
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker
//
// This is to take any continuous quantity and change it from one value
// to another over time. This code is for floats. It can be adapted to work for:
//
// Vector2, Vector3, Vector3