Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / uppercase.md
Created December 12, 2022 10:07
Excel Macro: Converted Selected cell texts to uppercase

To use this macro, follow these steps:

Open the Microsoft Excel worksheet that contains the cell or cells with the text you want to convert to uppercase.
Press Alt+F11 to open the Visual Basic editor.
In the Project Explorer window on the left, expand the tree for your workbook and double-click on the sheet that contains the cell or cells you want to convert to uppercase.
In the code editor window on the right, paste the code from above.
To run the macro, press F5 or click on the Run button in the toolbar.
Select the cell or cells that you want to convert to uppercase, and the macro will convert the text in those cells to uppercase.

Note: If you want to use this macro on a regular basis, you can save it in your personal macro workbook so that it is available in all of your Excel workbooks. To do this, follow these steps:

@unitycoder
unitycoder / DancePad.cs
Created December 12, 2022 12:32 — forked from mathiassoeholm/DancePad.cs
Unity dance pad input
using System;
using System.Collections.Generic;
using UnityEngine;
using Object = UnityEngine.Object;
namespace DancePadInput
{
public enum Player
{
Any,
@unitycoder
unitycoder / game design.md
Last active March 27, 2023 14:42
Game Design
@unitycoder
unitycoder / Nature_Bark.shader
Created December 14, 2022 09:35
Nature Bark & Leaf shader
// https://forum.unity.com/threads/tree-it-free-foliage-and-tree-creation-software.874579/
// Upgrade NOTE: replaced '_CameraToWorld' with 'unity_CameraToWorld'
 
Shader "TOZ/Nature/Bark" {
    Properties {
        _Color("Main Color", Color) = (1,1,1,0)
        _MainTex("Main Texture", 2D) = "white" {}
        _BaseLight("Base Light", Range(0, 1)) = 0.35
        _AO("Amb. Occlusion", Range(0, 10)) = 2.4
 
@unitycoder
unitycoder / DownloadFile.cs
Created December 14, 2022 10:43
c# download file to temp folder using WebClient
// by chatGPT
using System.Net;
// The URL of the file to download
string url = "https://www.example.com/file.zip";
// Create a new instance of the WebClient class
WebClient client = new WebClient();
// Download the file to the temporary folder
@unitycoder
unitycoder / what is stun server for WebRTC.md
Created December 15, 2022 13:58
what is stun server for WebRTC

// by chatGPT

what is stun server for WebRTC

A STUN server is used in conjunction with the WebRTC protocol to determine the public IP address of a client and to establish a connection between two clients. The STUN server is used to assist with the NAT traversal of the clients, allowing them to communicate with each other even if they are behind a firewall or NAT. This is an important part of the WebRTC protocol, as it allows for peer-to-peer communication without the need for a central server.

@unitycoder
unitycoder / how to make unity shadergraph that has scrolling texture.md
Created December 16, 2022 10:47
how to make unity shadergraph that has scrolling texture

// by chatGPT

how to make unity shadergraph that has scrolling texture?

To create a scrolling texture effect in Unity's Shader Graph, you can use the following steps:

Open Unity and create a new project.
Create a new material and assign it a Shader Graph.
In the Shader Graph window, create a new 2D Texture Sample node by right-clicking in the graph and selecting "2D Texture Sample" from the context menu.

Connect the output of the 2D Texture Sample node to the Albedo input of the Master node.

@unitycoder
unitycoder / TransformUpdater.cs
Created December 16, 2022 14:35
unity simple job system for handling thousands of moving transforms
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
public struct TransformData
{
public float3 position;
public quaternion rotation;
}
@unitycoder
unitycoder / sdl main loop, should input be first or last.md
Last active December 16, 2022 16:21
SDL main loop: should input be first or last?

ChatGPT:

In an SDL (Simple DirectMedia Layer) main loop, it's generally best to process input before updating the game state and rendering graphics. This allows the game to respond to input as quickly as possible, and ensures that the game state and graphics are updated based on the most current input.

Here's an example of a typical SDL main loop structure:

while (gameIsRunning) {
    // Process input
    handleInput();