Skip to content

Instantly share code, notes, and snippets.

View arif-pandu's full-sized avatar
🏠
Working from home

Mapandu arif-pandu

🏠
Working from home
  • Cilacap, Central Java, Indonesia
  • X @mapen_
View GitHub Profile
@fadookie
fadookie / CameraAnchor.cs
Last active April 29, 2024 12:19
Screen-relative anchoring component for Unity3D. Find more Unity code at http://www.eliotlash.com/2015/01/unity3d-components-and-code-snippets/
/***
* This script will anchor a GameObject to a relative screen position.
* This script is intended to be used with ViewportHandler.cs by Marcel Căşvan, available here: http://gamedev.stackexchange.com/a/89973/50623
* It is also copied in this gist below.
*
* Note: For performance reasons it's currently assumed that the game resolution will not change after the game starts.
* You could not make this assumption by periodically calling UpdateAnchor() in the Update() function or a coroutine, but is left as an exercise to the reader.
*/
/* The MIT License (MIT)
@lopspower
lopspower / README.md
Last active July 31, 2024 03:20
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@michidk
michidk / OutlineShader.shader
Last active May 28, 2024 17:13
An outline shader made for Unity with the help of @OverlandGame. It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// An outline shader made for Unity with the help of @OverlandGame by @miichidk
// It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// See how it looks here: https://twitter.com/OverlandGame/status/791035637583388672
// How to use: Create a material which uses this shader, and apply this material to any meshrenderer as second material.
Shader "OutlineShader"
{
Properties
{
_Width ("Width", Float ) = 1
_Color ("Color", Color) = (1,1,1,1)
@haakov
haakov / FpsController.cs
Created April 1, 2017 13:36
Unity3D FPS Controller
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FpsController : MonoBehaviour {
public float mouseSensitivityX = 1.0f;
public float mouseSensitivityY = 1.0f;
public float walkSpeed = 10.0f;
@nnm-t
nnm-t / ConvertToSprite.cs
Last active July 20, 2024 09:24
Convert Texture2D To Sprite
using UnityEngine;
public static class ConvertToSpriteExtensiton
{
public static Sprite ConvertToSprite(this Texture2D texture)
{
return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
}
}
@IJEMIN
IJEMIN / PlayCloudDataManager.cs
Last active November 7, 2023 12:08
Unity Google Cloud Saved Game Data Manager Script
// code reference: http://answers.unity3d.com/questions/894995/how-to-saveload-with-google-play-services.html
// you need to import https://github.com/playgameservices/play-games-plugin-for-unity
using UnityEngine;
using System;
using System.Collections;
//gpg
using GooglePlayGames;
using GooglePlayGames.BasicApi;
using GooglePlayGames.BasicApi.SavedGame;
//for encoding
@GibsS
GibsS / RoundedRectGraphic.cs
Last active October 9, 2023 21:13
A Unity Canvas UI Graphic for a rectangle with rounded edges
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
[ExecuteInEditMode]
public class RoundRectGraphic : Graphic {
[Range(0, 200)]
public int radius;
public bool hasTop;
@yasirkula
yasirkula / CircleGraphic.cs
Last active July 10, 2024 08:55
Create circles/ellipses in Unity UI system in one of three modes: FillInside, FillOutside and Edge.
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
using UnityEditor;
// Custom Editor to order the variables in the Inspector similar to Image component
[CustomEditor( typeof( CircleGraphic ) ), CanEditMultipleObjects]
public class CircleGraphicEditor : Editor
{
@sebtoun
sebtoun / JsonSerialisableScriptableObject.cs
Last active February 27, 2024 17:25
Unity's ScriptableObjects that easily serialize to JSON
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using UnityEngine;
public class JsonSerialisableScriptableObject<T> : ScriptableObject where T : JsonSerialisableScriptableObject<T>
{
@muddassirm
muddassirm / LoadJson3.dart
Created August 24, 2018 18:30
Display JSON data in Flutter : Using a FutureBuilder
import 'package:flutter/material.dart';
import 'dart:convert';
import 'dart:async' show Future;
import 'package:flutter/services.dart' show rootBundle;
class Student {
String studentId;
String studentName;
int studentScores;