Skip to content

Instantly share code, notes, and snippets.

View gkagm2's full-sized avatar
πŸ˜†
..

Sagacity Jang gkagm2

πŸ˜†
..
View GitHub Profile
@gkagm2
gkagm2 / gist:ab185883d4497e6742669cf490dcdc86
Created April 16, 2020 15:23
Verticesλ“€μ˜ worldPosition μ’Œν‘œ κ΅¬ν•˜κΈ°.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test_ModelAnimationPath : MonoBehaviour
{
public string positionName;
public MeshFilter meshFilts;
public List<Vector3> vecList;
@gkagm2
gkagm2 / Raycast
Last active June 20, 2019 05:33
RaycastAll code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class csRaycast : MonoBehaviour {
private float speed = 5f;
// Use this for initialization
void Start () {
@gkagm2
gkagm2 / aniamtor,
Created June 18, 2019 06:41
aniamtorμ—μ„œ animation의 length μ„€μ •,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnityChanController06 : MonoBehaviour {
// parameters
public int speed;
@gkagm2
gkagm2 / SimpleJSON μ‚¬μš© 예제
Last active June 12, 2019 08:36
SimpleJSONμ‚¬μš©μ˜ˆμ œ
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using SimpleJSON;
public class PlayerState : MonoBehaviour
{
public string name;
public int hp;
@gkagm2
gkagm2 / CSV Reader
Created June 12, 2019 02:00
csv 파일 κ²€μΆœ
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
public class CSVReader
{
static string SPLIT_RE = @",(?=(?:[^""]*""[^""]*"")*(?![^""]*""))";
static string LINE_SPLIT_RE = @"\r\n|\n\r|\n|\r";
@gkagm2
gkagm2 / 2D ν”Œλ ˆμ΄μ–΄ xμΆ• μ›€μ§μž„ μ œν•œ ν•¨μˆ˜
Created May 30, 2019 17:50
2D ν”Œλ ˆμ΄μ–΄ xμΆ• μ›€μ§μž„ μ œν•œ ν•¨μˆ˜
// 2D ν”Œλ ˆμ΄μ–΄ xμΆ• μ›€μ§μž„ μ œν•œ
private void ScreenCheck(){
Vector3 worldPos = Camera.WorldToViewportPoint(this.transform.position);
if(worldPos.x < 0.05f) worldPos.x = 0.05f;
if(worldPos.x > 0.95f) worldPos.x = 0.95f;
this.transform.position = Camera.main.ViewportToWorldPoint(worldPos);
}
Shader "Custom/Tex" {
Properties {
///
/// "Albedo (RGB)" : Albedo ν…μŠ€μ³λ₯Ό λ„£λŠ” 곳이고, μ•ŒνŒŒλŠ” μ‚¬μš©ν•˜μ§€ μ•Šκ³  RGB μ±„λ„λ§Œ μ‚¬μš©ν•˜κ² λ‹€λŠ” 의미.
/// 2D : 이 μΈν„°νŽ˜μ΄μŠ€κ°€ 2D ν…μŠ€μ³λ₯Ό λ°›λŠ” λΆ€λΆ„μ΄λΌλŠ” 의미.
/// "white"{} : λŠ” 이 ν…μŠ€μ³κ°€ μΈν„°νŽ˜μ΄μŠ€κ°€ 처음 μƒκ²¨μ„œ 아무것도 λ“€μ–΄ μžˆμ§€ μ•Šμ„ λ•Œ. 흰색 ν…μŠ€μ³κ°€ λ“€μ–΄μžˆλ‹€κ³  μƒκ°λ˜λ„λ‘ λ§Œλ“€λΌλŠ” 의미
_MainTex ("Albedo (RGB)", 2D) = "white" {} // ν…μŠ€μ³λ₯Ό μž…λ ₯λ°›λŠ” λ³€μˆ˜.
}
SubShader {
@gkagm2
gkagm2 / Shader
Created May 20, 2019 08:47
ShaderEx
Shader "Custom/NewSurfaceShader" {
Properties { // μΈμŠ€νŽ™ν„° μ°½μ—μ„œ λ³΄μ—¬μ£ΌλŠ”
_Brightness("Change Brightness!!", Range(0,1)) = 0.5
_TestFloat("Test Float!!", Float) = 0.5
_TestColor("Test Color!!", Color) = (1,1,1,1)
_TestVector("Test Vector", Vector) = (1,1,1,1)
_TestTexture("Test Texture",2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
@gkagm2
gkagm2 / touch screen1
Last active April 25, 2019 16:01
Touch Screen (mobile)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchScreenEx : MonoBehaviour {
//손가락을 화면에 닿은 μƒνƒœμ—μ„œ 움직이면 물체가 움직인닀
void Update () {
if(Input.touchCount > 0 ){
@gkagm2
gkagm2 / UISprite (change icon)
Created April 25, 2019 07:04
UISprite (NGUI)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpriteManager : MonoBehaviour {
public UISprite icon;
// Use this for initialization
void Start () {