| Platform | URL | |
|---|---|---|
| Website | https://unitycoder.com/blog/ | .. |
| Github | https://github.com/unitycoder | .. |
| Unity Forums | https://discussions.unity.com/u/mgear/ | .. |
| https://twitter.com/unitycoder_com | ![]() |
|
| Mastodon | https://mastodon.gamedev.place/@unitycoder | .. |
| Youtube | https://www.youtube.com/@unitycoder | ![]() |
| https://www.linkedin.com/in/unitycoder/ | ![]() |
|
| Discord | https://discord.com/invite/cXT97hU | .. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // chatGPT | |
| // Here is a simple function that generates a gradient PNG image from 8 colors: | |
| function generateGradient(colors) { | |
| // Create an image object | |
| var img = new Image(); | |
| // Create a canvas element | |
| var canvas = document.createElement('canvas'); | |
| var ctx = canvas.getContext('2d'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const id = "kiriban-fuminige-kinshi"; | |
| const conversions = [ | |
| { unit: "K", rate: 1000 }, | |
| { unit: "M", rate: 1000000 }, | |
| { unit: "B", rate: 1000000000 }, | |
| { unit: "万", rate: 10000 }, | |
| ]; | |
| function run(target) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // by chatGPT | |
| void CubicSpline(List<Vector2> controlPoints, int numPoints) | |
| { | |
| // Initialize the list of spline points | |
| List<Vector2> splinePoints = new List<Vector2>(); | |
| // Add the first control point to the spline points | |
| splinePoints.Add(controlPoints[0]); | |
| // Loop through the control points and calculate the spline points |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // chatGPT | |
| void BresenhamFilledCircle(int x0, int y0, int radius) | |
| { | |
| // Initialize the variables needed to draw the circle | |
| int x = radius; | |
| int y = 0; | |
| int decisionOver2 = 1 - x; // Decision criterion divided by 2 evaluated at x=r, y=0 | |
| // Loop through the y values from 0 to the radius | |
| while (y <= x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // chatGPT | |
| // DDA = Digital Differential Analyzer | |
| void DDA(int x1, int y1, int x2, int y2) | |
| { | |
| // Calculate the difference between the start and end points | |
| int dx = x2 - x1; | |
| int dy = y2 - y1; | |
| // Calculate the number of steps required to draw the line | |
| int steps = Math.Abs(dx) > Math.Abs(dy) ? Math.Abs(dx) : Math.Abs(dy); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // chatGPT | |
| void draw_line(int x1, int y1, int x2, int y2, uint32_t color) | |
| { | |
| // Bresenham's line algorithm | |
| int dx = (x2 - x1 >= 0) ? x2 - x1 : x1 - x2; | |
| int dy = (y2 - y1 >= 0) ? y2 - y1 : y1 - y2; | |
| int sx = (x1 < x2) ? 1 : -1; | |
| int sy = (y1 < y2) ? 1 : -1; | |
| int err = dx - dy; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // chatGPT | |
| SOHCAHTOA is a way to help us remember how to solve math problems involving triangles. It stands for: | |
| S - Sine: The sine of an angle is a number that tells us how tall a triangle is, if we draw a line from the angle to the bottom of the triangle. | |
| O - Opposite: The opposite side of a triangle is the side that is opposite (or across from) the angle that we are interested in. | |
| H - Hypotenuse: The hypotenuse is the longest side of a right triangle. It is always opposite the right angle (90 degree angle). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int size = 10; | |
| for (int x = 0; x < window_width; x++) | |
| { | |
| for (int y = 0; y < window_height; y++) | |
| { | |
| int i = window_width * y + x; | |
| //color_buffer[i] = (x % size) * (y % size) ? 0x00000000 : 0xFFFFFFFF; | |
| color_buffer[i] = ~(1 - (x % size) * (y % size)) & 0xFFFFFFFF; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Shader "Universal Render Pipeline/2D/SimpleSpriteShader" | |
| { | |
| Properties | |
| { | |
| _MainTex("_MainTex", 2D) = "white" {} | |
| } | |
| HLSLINCLUDE | |
| #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" |


