Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Prashant Priyadarshi PrashantUnity

🎯
Focusing
View GitHub Profile
View Highlight.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>HighLight Js Example </title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.5.1/highlight.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
View CpuUses.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace CpuUses
{
class Program
{
static PerformanceCounter cpuCounter;
@PrashantUnity
PrashantUnity / LeetCodeTreeMaker.cs
Created October 5, 2022 04:01
Will Help in debugging on your local computer
View LeetCodeTreeMaker.cs
public class Program
{
static void Main(string[] args)
{
var arr = new int[] {1,2,3,4,5,6,7,8,9};
var tree = new LeetCodeTree().MakeTree(arr);
BFS(tree);
}
}
public class LeetCodeTree
@PrashantUnity
PrashantUnity / MaterialColor.cs
Created August 29, 2022 06:39
Setting Random Material color to game object inside unity editor
View MaterialColor.cs
var newObstacle = Instantiate(cube, new Vector3(i, 0, j), Quaternion.identity, transform);
Renderer obstacleRenderer = newObstacle.GetComponent<Renderer>();
Material mat = new Material(obstacleRenderer.sharedMaterial);
mat.color = GetRandomColor();
obstacleRenderer.sharedMaterial = mat;
//
public Color GetRandomColor()
View Editor.cs
// MapGenerator is class on which this custom editor will be called
using UnityEditor;
[CustomEditor(typeof(MapGenerator))]
public class Edit : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
// if you remove |^|(base.OnInspectorGUI(); )
// variable in inspector may not show up properly
@PrashantUnity
PrashantUnity / ShapesData.cs
Created August 28, 2022 16:10
Creating Shapes points in 3d Space
View ShapesData.cs
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using UnityEngine;
using static TMPro.SpriteAssetUtilities.TexturePacker_JsonArray;
public class ShapesData
{
public float circleRadius;
public Vector2 rectangle;
@PrashantUnity
PrashantUnity / Edit.cs
Created August 27, 2022 15:05
Mesh Generation basic
View Edit.cs
using UnityEditor;
[CustomEditor(typeof(MapGenerator))]
public class Edit : Editor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
MapGenerator mapGenerator = (MapGenerator)target;
mapGenerator.Function();
}
@PrashantUnity
PrashantUnity / PrefabInstantiate.cs
Last active August 21, 2022 10:44
Generate Prefab on Spherical Object
View PrefabInstantiate.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MapGenerator : MonoBehaviour
{
public GameObject objectToGenerated;
public float theta;
public float radius;
@PrashantUnity
PrashantUnity / ChangingMaterials.cs
Last active August 13, 2022 05:18
Dynamically Change Materials
View ChangingMaterials.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DeerScript : MonoBehaviour
{
// this is gameobject whose material will be changed
public GameObject target;
View Countdown.cs
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
public class CountDown : MonoBehaviour
{
public float InstantiationTimer = 2f;
public float interval = 2f;