Skip to content

Instantly share code, notes, and snippets.

View dimmduh's full-sized avatar
🎮
Learning Unity

Dmitrii Dukhnich dimmduh

🎮
Learning Unity
View GitHub Profile
const sales = 2871;
//result of https://api.dtf.ru/v2.31/comments?contentId=2922979&sorting=da
const comments = require('./input.json');
console.log(comments.result.items.length);
let result = comments.result.items
.filter(function (item) {
return item.level === 0;
@dimmduh
dimmduh / profile stats.txt
Created March 23, 2024 11:55
Unity 2023.2.10f1 available profile stats
Ai - Carving.ApplyResults - TimeNanoseconds
Ai - Carving.BuildBVTree - TimeNanoseconds
Ai - Carving.Clipping - TimeNanoseconds
Ai - Carving.ConvexHulls - TimeNanoseconds
Ai - Carving.Prepare - TimeNanoseconds
Ai - Carving.ProjectVertices - TimeNanoseconds
Ai - CollectSources - TimeNanoseconds
Ai - Colliders - TimeNanoseconds
Ai - Components.NavMeshAgent.SendMessage - TimeNanoseconds
Ai - Components.NavMeshAgent.State - TimeNanoseconds
@dimmduh
dimmduh / z_DebugPunCallbacks.cs
Created February 29, 2024 09:11
Debug Log Unity Photon Pun Callback
using System;
using System.Collections.Generic;
using ExitGames.Client.Photon;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using Hashtable = ExitGames.Client.Photon.Hashtable;
public class z_DebugPunCallbacks : MonoBehaviourPunCallbacks
{
@dimmduh
dimmduh / download photo from vk with date
Last active November 26, 2023 07:19
Скачивает фото из Вконтакте и вставляет дату в имя файла
//Download image from vk
var $ = $;
function convertImageToBase64(imgUrl, callback) {
const image = new Image();
image.crossOrigin='anonymous';
image.onload = () => {
const canvas = document.createElement('canvas');
[MenuItem(z_EditorPrefs.ContextMenuInHierarchyCommonPath + "/Fix Before export FBX", false)]
public static void FixBeforeExportFbx()
{
if (!Selection.activeGameObject)
{
return;
}
foreach (var gameObject in Selection.gameObjects)
@dimmduh
dimmduh / z_DarkSkyboxFix.cs
Last active December 21, 2022 09:52
Unity fix dark scene after scene loading (skybox, reflection probe)
using System.Collections;
using UnityEngine;
using UnityEngine.Rendering;
//https://forum.unity.com/threads/solved-scenemanager-loadscene-make-the-scene-darker-a-bug.542440/#post-7752681
public class z_DarkSkyboxFix : MonoBehaviour
{
IEnumerator Start()
{
if (RenderSettings.customReflectionTexture != null)
Mary
Patricia
Jennifer
Linda
Elizabeth
Barbara
Susan
Jessica
Sarah
Karen
James
Robert
John
Michael
William
David
Richard
Joseph
Thomas
Charles
@dimmduh
dimmduh / z_Texture2DJsonConverter.cs
Created August 30, 2021 09:01
json.net converter for Unity Texture
using System;
using Newtonsoft.Json;
using UnityEngine;
public class z_Texture2DJsonConverter : JsonConverter<Texture2D>
{
public override void WriteJson(JsonWriter writer, Texture2D? value, JsonSerializer serializer)
{
writer.WriteValue(value.EncodeToPNG());
}
@dimmduh
dimmduh / init.cs
Created April 7, 2021 17:29
Unity Texture2D json.net serialization
jsonSerializerSettings = JsonConvert.DefaultSettings.Invoke();
jsonSerializerSettings.TypeNameHandling = TypeNameHandling.Auto;
jsonSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
jsonSerializerSettings.Converters.Add(new z_Texture2DJsonConverter());
if (Debug.isDebugBuild || Application.isEditor)
jsonSerializerSettings.Formatting = Formatting.Indented;