Skip to content

Instantly share code, notes, and snippets.

@HajiyevEl
HajiyevEl / WeaponSway.cs
Created March 15, 2025 08:03 — forked from pppoe252110/WeaponSway.cs
Correct Weapon Sway implementation which does not depend on fps
using UnityEngine;
public class WeaponSway : MonoBehaviour
{
[SerializeField] private Transform weaponTransform;
[Header("Sway Properties")]
[SerializeField] private float swaySmooth = 8f;
[SerializeField] private float swayDamp = 2f;
[SerializeField] private float posToRotAmount = 1f;
@HajiyevEl
HajiyevEl / OptimalSpatialHashing.cs
Created January 30, 2025 08:41 — forked from adammyhre/OptimalSpatialHashing.cs
Unity Spatial Hashing with Jobs and Burst
using System;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class OptimalSpatialHashing : MonoBehaviour {
@HajiyevEl
HajiyevEl / README.md
Created October 14, 2024 11:21 — forked from jamiephan/README.md
A script to automatically add ALL items to your account in quixel

Script to add all items from quixel

As quixel is being removed, all items are free to aquire. This script is to automate the process to add items to your account (As of writing, a total of 18874 items)

Note: This script only tested in the latest version of Chrome.

How to use

  1. Copy the script from below (run.js)
  2. Login into https://quixel.com
@HajiyevEl
HajiyevEl / FixMeshRotationEditor.cs
Created September 2, 2024 09:06 — forked from blizzy78/FixMeshRotationEditor.cs
FixMeshRotationEditor.cs - Unity: Fix mesh's rotation after importing from Blender
using UnityEngine;
using UnityEditor;
/*
Fixes a mesh's rotation after importing it from Blender. In Blender, the Z axis points in the
"up" direction, while in Unity, Z points in the "forward" direction. This script rotates the
mesh's vertices so that it is upright again.
To use this, create an object from a mesh in the hierarchy view, then locate the Mesh Filter
in the inspector. There, click on the new "Fix Rotation" button.
@HajiyevEl
HajiyevEl / NativeArrayOfArrays.cs
Created May 19, 2024 14:17 — forked from shanecelis/NativeArrayOfArrays.cs
Make one long linear NativeArray look like a two-dimensional jagged array.
/* Original code[1] Copyright (c) 2022 Shane Celis[2]
Licensed under the MIT License[3]
[1]: https://gist.github.com/shanecelis/f0e295b12ec1ab09f67ad5980ac9b324
[2]: https://twitter.com/shanecelis
[3]: https://opensource.org/licenses/MIT
*/
using System;
using System.Collections.Generic;
@HajiyevEl
HajiyevEl / greedyvoxelmeshing
Created May 19, 2024 10:00 — forked from Vercidium/greedyvoxelmeshing
Greedy Voxel Meshing ported to C#
// Code ported from https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/
// Note this implementation does not support different block types or block normals
// The original author describes how to do this here: https://0fps.net/2012/07/07/meshing-minecraft-part-2/
const int CHUNK_SIZE = 32;
// These variables store the location of the chunk in the world, e.g. (0,0,0), (32,0,0), (64,0,0)
@HajiyevEl
HajiyevEl / VertBend.cs
Created August 13, 2023 09:00 — forked from MattRix/VertBend.cs
Example of doing a vertex modifer for Unity UI stuff
using UnityEngine.UI;
using System.Collections.Generic;
using System;
using UnityEngine;
public class VertBend : BaseMeshEffect
{
public override void ModifyMesh(VertexHelper vh)
{
if(!IsActive()) return;
@HajiyevEl
HajiyevEl / UnityAsyncOperationAwaiter.cs
Created August 13, 2023 09:00 — forked from mattyellen/UnityAsyncOperationAwaiter.cs
Allows the use of async/await (instead of yield) with any Unity AsyncOperation
public static class ExtensionMethods
{
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp)
{
var tcs = new TaskCompletionSource<object>();
asyncOp.completed += obj => { tcs.SetResult(null); };
return ((Task)tcs.Task).GetAwaiter();
}
}
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@HajiyevEl
HajiyevEl / BlurImage.shader
Created July 24, 2023 09:44 — forked from nilpunch/BlurImage.shader
Blur for UI elements. Compatible with Built in RP, HDRP, URP and SRP.
Shader "UI/BlurImage"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[Space(50)]
_BlurX ("X Blur", Range(0.0, 0.5)) = 0.001
_BlurY ("Y Blur", Range(0.0, 0.5)) = 0.001