Skip to content

Instantly share code, notes, and snippets.

View MuhammadFaizanKhan's full-sized avatar

Muhammad Faizan Khan MuhammadFaizanKhan

View GitHub Profile
@burrussmp
burrussmp / Triangulate.cs
Created April 26, 2020 21:35
Triangulate function to extract the triangles from a list of vertices to construct a mesh in Unity
public class Triangulator
{
private List<Vector2> m_points = new List<Vector2>();
public Triangulator (Vector2[] points) {
m_points = new List<Vector2>(points);
}
public int[] Triangulate() {
List<int> indices = new List<int>();
@MuhammadFaizanKhan
MuhammadFaizanKhan / ObjectMovmentOnWayPoints.cs
Created December 14, 2017 07:40
Move object on way points in unity3d
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ObjectMovmentOnWayPoints : MonoBehaviour
{
#region Vars
public List<GameObject> movmentWayPoints;
@danielbierwirth
danielbierwirth / TCPTestClient.cs
Last active April 27, 2024 20:24
TCP Client-Server Connection Example | Unity | C# | Bidirectional communication sample: Client can connect to server; Client can send and receive messages: Server accepts clients; Server reads client messages; Server sends messages to client
// This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/
// or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using UnityEngine;
@HilariousCow
HilariousCow / gist:7f301b04c28fdf61e71f
Last active March 31, 2024 18:33
Load All Prefabs In Directory
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
public static class PrefabLoader
{
//So, there's no "load all assets in directory" function in unity.
//I guess this is to avoid people using Prefabs as "data blobs".
//They'd rather you use ScriptableObjects... which is fine in some cases,
@duraz0rz
duraz0rz / With_ORM.cs
Last active August 9, 2021 00:53
C# example with and without ORM
/*
Very simple example using LINQ to SQL and based on the MSDN LINQ to SQL page.
Make sure you include System.Data.Linq and System.Data.Linq.Mappings in your usings.
*/
// Table you want to associate with the entity
[Table(Name="Customer")]
public class Customer
{
// Columns in the database. Should have the same name between database and class variable