Skip to content

Instantly share code, notes, and snippets.

View gkagm2's full-sized avatar
😆
..

Sagacity Jang gkagm2

😆
..
View GitHub Profile
@gkagm2
gkagm2 / NGUI Button (GameObject)
Last active April 23, 2019 01:05
NGUI Button을 이용한 Label control
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 방법 1
public class ButtonManager : MonoBehaviour {
public bool flag = true;
public GameObject label; //GameObject를 이용한다
public void StartBtn()
@gkagm2
gkagm2 / PlayerPrefs
Created April 20, 2019 14:38
PlayerPrefs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor; // need
public class csGameManager : MonoBehaviour {
// Use this for initialization
void Start () {
@gkagm2
gkagm2 / AsyncOperation
Last active April 20, 2019 12:59
웹 통신 할 떄의 Coroutine 사용법
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class csCoroutine2 : MonoBehaviour {
//비동기 작업이 끝날 때까지 댁시
public string url; //웹 주소를 저장할 스트링 변수를 퍼블릭으로 선언한다.
WWW www; //WWW 타입의 변수를 선언한다.
@gkagm2
gkagm2 / Distance
Created April 20, 2019 00:16
Uselful API(Distance, Random, FindChild
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class csDistance : MonoBehaviour {
//거리를 구하기 위한 게임 오브젝트들의 트랜스폼을 저장할 변수 선언.
public Transform box1;
public Transform box2;
public Transform box3;
@gkagm2
gkagm2 / KeyMovePhone
Created April 20, 2019 00:11
KeyMovePhone
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class csKeyMovePhone : MonoBehaviour {
// Use this for initialization
void Start () {
}
@gkagm2
gkagm2 / GizemoView (DrawSphere)
Created April 20, 2019 00:08
GizemoView (DrawSphere)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class csGizmoView : MonoBehaviour {
public Color _color = Color.red;
public float _radius = 0.2f;
void OnDrawGizmos()
@gkagm2
gkagm2 / Quaternion 예제
Created April 19, 2019 23:49
Quaternion
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class csKeyMove : MonoBehaviour {
public float a;
public float x;
// Update is called once per frame
void Update () {
//Horizontal - Z axis
@gkagm2
gkagm2 / RayCast Example
Created April 17, 2019 08:23
RayCast 예제 코드
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RayCastEx : MonoBehaviour {
void OnCreate() { }
void OnUpdate() { }
void OnDrawGizmos()
@gkagm2
gkagm2 / Random.onUnitShere
Created April 17, 2019 02:33
Random.onUnitShere (산탄 만들때 사용)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyRandomOnUnitSphere : MonoBehaviour {
// Update is called once per frame
void Update () {
Vector3 start = Random.onUnitSphere;
Debug.DrawLine(start - Vector3.forward * 0.01f, start + Vector3.forward * 0.01f, Color.green, 50.0f);
Debug.DrawLine(start - Vector3.right * 0.01f, start + Vector3.right * 0.01f, Color.green, 50.0f);
@gkagm2
gkagm2 / character move
Last active April 16, 2019 02:21
Character move
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharacterMove : MonoBehaviour {
public Transform cameraTransform;
public float moveSpeed = 10.0f;
public float jumpSpeed = 10.0f;
public float gravity = -20.0f;