Instantly share code, notes, and snippets.

View .gitignore
# Created by https://www.gitignore.io/api/unity
# Edit at https://www.gitignore.io/?templates=unity
# Jetbrain Rider Cache
.idea/
Assets/Plugins/Editor/JetBrains*
# Visual Studio Code
.vscode/
View SpriteMerger.cs
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
// Merge multiple Sprites as one sprite
public static class SpriteMerger {
public static Sprite MergeSprite(Sprite[] sprites) {
// 스프라이트 중 가장 큰 크기의 것으로 지정되야함
View NavMeshUtil.cs
using UnityEngine.AI;
using UnityEngine;
public static class NavMeshUtil {
// Get Random Point on a Navmesh surface
public static Vector3 GetRandomPoint(Vector3 center, float maxDistance) {
// Get Random Point inside Sphere which position is center, radius is maxDistance
Vector3 randomPos = Random.insideUnitSphere * maxDistance + center;
View inviteAll.js
var foundAny=false;
function selectAllByLetter(remainingLetters) {
console.log(remainingLetters)
var letter = remainingLetters.pop();
$("#channel_invite_filter").val(letter).trigger("input");
setTimeout(function() {
$(".channel_invite_member:not(hidden)").each(function(i, obj) {
foundAny=true;
this.click();
});
View TermalRed.shader
Shader "Custom/TermalRed" {
Properties {
_NormalTex("Normal Texture",2D) = "white" {}
_DistanceFadeOut("DistanceFadeOut",Range(0,3)) = 0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
View ImageLoader.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
// 로컬 이미지 파일 경로를 주면 해당 경로에서 이미지를 로드해 UI Image로 띄어주는 코드
public class ImageLoader : MonoBehaviour {
// 스프라이트를 로드할 이미지 컴포넌트
View RayByAngle.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RayByAngle : MonoBehaviour {
public float angle;
public float distance = 1f;
// Update is called once per frame
View AdmobBannerLoader.cs
//Add Symbol "USING_GOOGLE_MOBILE_ADS" to Build Setting after import GoogleMobileAds library from here https://github.com/googleads/googleads-mobile-unity
#if USING_GOOGLE_MOBILE_ADS
using UnityEngine;
//using System.Collections;
using GoogleMobileAds.Api;
public class AdmobBannerLoader : MonoBehaviour {
public string adUnitId;
View ExportPackage.cs
// 단순 유니티 패키지 제작용 스크립트
using UnityEngine;
using System.Collections;
using UnityEditor;
public static class ExportPackage {
View PlayCloudDataManager.cs
// 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