Skip to content

Instantly share code, notes, and snippets.

@farukcan
farukcan / EnumValues.cs
Last active January 30, 2022 16:34
C# Get All Enum Values
public class Example : MonoBehaviour
{
private enum TetrisPiece
{
Line, Square, T, J, L, S, Z
}
RandomBag<TetrisPiece> pieceBag;
void Awake()
@farukcan
farukcan / InfiniteLinePlacer.cs
Last active February 1, 2022 20:18
Infinite object placing on an infinite line with object pooling
// Author: github/farukcan
// Youtube Video: https://www.youtube.com/watch?v=uq8KGcLmKvA
// Requires: Pool.cs ( https://gist.github.com/farukcan/3a317afc2737822e29bbb18f919f4381 )
// Requires: OdinInspector (But you can remove odin codes if you don't use it)
// Note: You can see place points and infinite line on unity editor
// Spec: Change 'seed' to change randomness
// Spec: set randomizationScale for place object to little bit random place
// Spec: randomizeX,Y,Z for randomization axies
// Spec: 'probility' for object placing ratio
// Spec: set 'origin' to you camera or your character (for auto place)
@farukcan
farukcan / OnLoadMethodAttribute.cs
Created February 8, 2022 07:50
Run static function when unity game is loaded
// Create a non-MonoBehaviour class which displays
// messages when a game is loaded.
using UnityEngine;
class MyClass
{
[RuntimeInitializeOnLoadMethod]
static void OnRuntimeMethodLoad()
{
Debug.Log("After Scene is loaded and game is running");
@farukcan
farukcan / note.md
Created February 8, 2022 08:00
Unity Camera Stacking For Multiple Camera Rendering

Camera Stacking Types 1-n (relation)

  • Base
  • Overlay

ToDOs

  • Create The Cameras
  • Select Render Type
  • Select Culling Musk
@farukcan
farukcan / note.md
Last active February 8, 2022 08:36
Github Gist Backling

Adamlar gistlerimin altına yorum yaparak backlink kasmaya çalışıyor. Çok ilginç ve zararsız bir şekilde çalışıyordur bu yöntem muhtemelen.

@farukcan
farukcan / note.md
Last active February 11, 2022 10:33
Unity Color Palette Generator Fikri
@farukcan
farukcan / HierarchyWindowGroupHeader.cs
Last active September 18, 2023 08:19
Colorfull Hierarchy Window Group Header
using UnityEngine;
using UnityEditor;
/// <summary>
/// Colorful Hierarchy Window Group Header
/// Author: github.com/farukcan
/// Thanks for concept of idea :
/// http://diegogiacomelli.com.br/unitytips-hierarchy-window-group-header
/// Sample GameObject Names: "#red CAMERA" , "#" , "##E7A5F6 Hex" , "# "
/// </summary>
@farukcan
farukcan / Vehicle.cs
Created September 29, 2022 22:29
Indexer
// Vehicle vehicle = new Vehicle("Car");
// vehicle["frame"] = "carbon";
// vehicle["wheelCount"] = "4";
class Vehicle
{
private string _vehicleType;
private Dictionary<string, string> _parts =
new Dictionary<string, string>();
// Constructor
@farukcan
farukcan / Person.java
Last active October 3, 2022 11:37 — forked from bayraktugrul/Person.java
Builder Pattern Sample
// Person person = new Person.Builder().name("Name").surname("Surname").address("Address").build();
public class Person {
private String name, surname, address;
public Person(Builder builder) {
this.name = builder.name;
this.surname = builder.surname;
this.address = builder.address;
@farukcan
farukcan / text.md
Last active August 11, 2023 14:55
En İyi Design Pattern Yazıları