'분류 전체보기'에 해당되는 글 495건

  1. 2014.01.19 c# 기본서 추천(c# IN DEPTH)
  2. 2014.01.18 Animation Parameters
  3. 2014.01.17 MS Word 당구장 표시
  4. 2014.01.17 맥에서 스크린샷 캡쳐하기
  5. 2014.01.16 [펌] 유니티 디바이스 화면에 디버깅 콘솔 찍기
  6. 2014.01.16 [펌] 유니티3D Conditional Attribute 사용
  7. 2014.01.16 [펌] 유니티 엔진 - 텍스트 파일을 이용하여 에셋 번들 한꺼번에 생성 하기
  8. 2014.01.16 [펌] 유니티엔진 - 유니티 스키닝 설정.
  9. 2014.01.16 [펌] 유니티 안드로이드 빌링 api3 적용 팁입니다.
  10. 2014.01.16 [펌] 유니티 엔진 팁 - 광고 모듈 붙이기

c# 기본서 추천(c# IN DEPTH)

|



C# IN DEPTH

저자
존 스킷 지음
출판사
웰북 | 2009-09-07 출간
카테고리
컴퓨터/IT
책소개
『C# IN DEPTH』은 존 스킷이 저술한 것이다. C# 2와...
가격비교 글쓴이 평점  



이 책이 얼마나 좋은지에 대해서 더 떠들어봤자 입만 아플 것이고(아니, 손가락이 아프겠군요), 번역서에 서문으로 적은 내용을 일부 인용하는 것으로 이 책의 소개를 대신할까 합니다.

정말 좋은 책이라고 c# 을 하시는 분들은 많이 추천해 주시더라고요.

뭐 가장 큰 단점은 번역이라고 할정도로 책 내용은 좋다.

천천히 읽어봅시다.

자꾸 책만 사날리는게 아닌가 싶기도 하지만 c# 책은 한권도 사지 않아서 일단 질러놨습니다.


Trackback 0 And Comment 0

Animation Parameters

|

Animation Parameters

Animation Parameters are variables that are defined within the animation system but can also be accessed and assigned values from scripts. For example, the value of a parameter can be updated by an animation curve and then accessed from a script so that, say, the pitch of a sound effect can be varied as if it were a piece of animation. Likewise, a script can set parameter values to be picked up by Mecanim. For example, a script can set a parameter to control a Blend Tree.

Default parameter values can be set up using the Parameters widget in the bottom left corner of the Animator window. They can be of four basic types:

  • Vector - a point in space
  • Int - an integer (whole number)
  • Float - a number with a fractional part
  • Bool - true or false value

Parameters can be assigned values from a script using functions in the Animator class: SetFloatSetInt, and SetBool.

Here's an example of a script that modifies parameters based on user input

using UnityEngine;
using System.Collections;


public class AvatarCtrl : MonoBehaviour {

	protected Animator animator;

	public float DirectionDampTime = .25f;

	void Start () 
	{
		animator = GetComponent<Animator>();
	}

	void Update () 
	{
		if(animator)
		{
			//get the current state
			AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);

			//if we're in "Run" mode, respond to input for jump, and set the Jump parameter accordingly. 
			if(stateInfo.nameHash == Animator.StringToHash("Base Layer.RunBT"))
			{
				if(Input.GetButton("Fire1")) 
					animator.SetBool("Jump", true );
			}
			else
			{
				animator.SetBool("Jump", false);				
			}

			float h = Input.GetAxis("Horizontal");
			float v = Input.GetAxis("Vertical");

			//set event parameters based on user input
			animator.SetFloat("Speed", h*h+v*v);
			animator.SetFloat("Direction", h, DirectionDampTime, Time.deltaTime);
		}		
	}   		  
}


Trackback 0 And Comment 0

MS Word 당구장 표시

|
오른쪽버튼 - 기호 삽입
문자코드 입력
203B


Trackback 0 And Comment 0

맥에서 스크린샷 캡쳐하기

|

= 스크린샷 단축키 =
화면의 그림을 파일로 저장                   shift + command + 3
화면의 그림을 클립보드에 복사             control + shift + command + 3
선택한 영역의 그림을 파일로 저장         shift + command + 4
선택한 영억의 그림을 클립보드에 복사   control + shift + command + 4

Trackback 0 And Comment 0

[펌] 유니티 디바이스 화면에 디버깅 콘솔 찍기

|
출처 : http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=on&ss=on&sc=on&keyword=%C0%AF%B4%CF%C6%BC&select_arrange=last_comment&desc=desc&no=317


using UnityEngine;
using System;
using System.Collections.Generic;
 
/// <summary>
/// A console that displays the contents of Unity's debug log.
/// </summary>
/// <remarks>
/// Developed by Matthew Miner (www.matthewminer.com)
/// Permission is given to use this script however you please with absolutely no restrictions.
/// </remarks>
public class Console : MonoBehaviour
{
public static readonly Version version = new Version(1, 0);
 
struct ConsoleMessage
{
public readonly string message;
public readonly string stackTrace;
public readonly LogType type;
 
public ConsoleMessage (string message, string stackTrace, LogType type)
{
this.message = message;
this.stackTrace = stackTrace;
this.type = type;
}
}
 
public KeyCode toggleKey = KeyCode.BackQuote;
 
List<ConsoleMessage> entries = new List<ConsoleMessage>();
Vector2 scrollPos;
bool show;
bool collapse;
 
// Visual elements:
 
const int margin = 20;
Rect windowRect = new Rect(margin, margin, Screen.width - (2 * margin), Screen.height - (2 * margin));
 
GUIContent clearLabel = new GUIContent("Clear", "Clear the contents of the console.");
GUIContent collapseLabel = new GUIContent("Collapse", "Hide repeated messages.");
 
void OnEnable () { Application.RegisterLogCallback(HandleLog); }
void OnDisable () { Application.RegisterLogCallback(null); }
 
void Update ()
{
if (Input.GetKeyDown(toggleKey)) {
show = !show;
}
}
 
void OnGUI ()
{
if (!show) {
return;
}
 
windowRect = GUILayout.Window(123456, windowRect, ConsoleWindow, "Console");
}
 
/// <summary>
/// A window displaying the logged messages.
/// </summary>
/// <param name="windowID">The window's ID.</param>
void ConsoleWindow (int windowID)
{
scrollPos = GUILayout.BeginScrollView(scrollPos);
// Go through each logged entry
for (int i = 0; i < entries.Count; i++) {
ConsoleMessage entry = entries[i];
 
// If this message is the same as the last one and the collapse feature is chosen, skip it
if (collapse && i > 0 && entry.message == entries[i - 1].message) {
continue;
}
 
// Change the text colour according to the log type
switch (entry.type) {
case LogType.Error:
case LogType.Exception:
GUI.contentColor = Color.red;
break;
 
case LogType.Warning:
GUI.contentColor = Color.yellow;
break;
 
default:
GUI.contentColor = Color.white;
break;
}
 
GUILayout.Label(entry.message);
}
 
GUI.contentColor = Color.white;
 
GUILayout.EndScrollView();
 
GUILayout.BeginHorizontal();
 
// Clear button
if (GUILayout.Button(clearLabel)) {
entries.Clear();
}
// Collapse toggle
collapse = GUILayout.Toggle(collapse, collapseLabel, GUILayout.ExpandWidth(false));
 
GUILayout.EndHorizontal();
 
// Set the window to be draggable by the top title bar
GUI.DragWindow(new Rect(0, 0, 10000, 20));
}
 
/// <summary>
/// Logged messages are sent through this callback function.
/// </summary>
/// <param name="message">The message itself.</param>
/// <param name="stackTrace">A trace of where the message came from.</param>
/// <param name="type">The type of message: error/exception, warning, or assert.</param>
void HandleLog (string message, string stackTrace, LogType type)
{
ConsoleMessage entry = new ConsoleMessage(message, stackTrace, type);
entries.Add(entry);
}
}


유용하네요

아무 GameObject에 컴포넌트로 붙이고

` (FPS에서 콘솔 버튼으로 많이 쓰는) 누르시면.... 좋겠으나...





폰은... 자판이 없을테니 별도로 콜하는 메서드 만드셔야합니다.


show 키변경으로 쓰시려면 KeyCode.Menu 권장


Trackback 0 And Comment 0

[펌] 유니티3D Conditional Attribute 사용

|

출처 : http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=on&ss=on&sc=on&keyword=%C0%AF%B4%CF%C6%BC&select_arrange=last_comment&desc=desc&no=315



·미리보기 | 소스복사·
  1. using ConditionalAttribute = System.Diagnostics.ConditionalAttribute;  
·미리보기 | 소스복사·
  1. using UnityEngine;  
  2. using System.Collections;  
  3.   
  4. using ConditionalAttribute = System.Diagnostics.ConditionalAttribute;  
  5.   
  6. public class NewBehaviourScript : MonoBehaviour {  
  7.   
  8.     // Use this for initialization  
  9.     void Start () {  
  10.       
  11.     }  
  12.       
  13.     // Update is called once per frame  
  14.     void Update () {  
  15.         call0 ();  
  16.         call1 ();  
  17.         call2 ();     
  18.     }  
  19.       
  20.     void call0()  
  21.     {  
  22.         Debug.Log("call0");  
  23.     }     
  24.       
  25.     [Conditional("CON1")]  
  26.     void call1()  
  27.     {  
  28.         Debug.Log("call1");  
  29.     }  
  30.       
  31.     [Conditional("CON2")]  
  32.     void call2()  
  33.     {  
  34.         Debug.Log("call2");  
  35.     }     
  36. }  


Trackback 0 And Comment 0

[펌] 유니티 엔진 - 텍스트 파일을 이용하여 에셋 번들 한꺼번에 생성 하기

|

출처 : http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=on&ss=on&sc=on&keyword=%C0%AF%B4%CF%C6%BC&select_arrange=last_comment&desc=desc&no=309


에셋 번들을 만들어야 하는데 파일 하나하나 찍어서 만들기가 너무 귀찮았습니다.

플랫폼마다 똑같은 노가다를 반복 해야 한다고 생각하니 눈앞이 캄캄하더군요.
그래서 텍스트 파일에 리스트를 쭉 적어놓고 읽어와서 일괄 생성하게 만들었습니다.


아래와 같이 파일의 경로를 쭉 적어줍니다.
patch_list.txt 로 저장을 하고 위치는 Resources폴더 아래에 둡니다.


Resources/Sound/main.ogg
Resources/Sound/fire.wav
Resources/character/human.prefab
Resources/character/lion.prefab
Resources/ui/shop.prefab
.
.
.
[Resources/patch_list.txt의 내용]



소스코드는 Assets/Editor 밑에 xxx.cs 로 넣어놓습니다. 파일 이름은 아무거나 넣어도 됩니다.
·미리보기 | 소스복사·
  1. [MenuItem("Assets/Generate All from file(Windows)")]    // 메뉴가 들어갈 위치입니다. Assets메뉴 하위.
  2. static void GenerateAll()  
  3. {  
  4.     // 빌드 타겟은 적절하게 맞춰주면 되겠죠.  
  5.     ExportAll(BuildTarget.StandaloneWindows);  
  6. }  
  7.   
  8.   
  9.   
  10.   
  11.   
  12. static void ExportAll(BuildTarget target)    
  13. {    
  14.     // 리스트를 읽어와서 줄 단위로 분리 해 줍니다.  
  15.     TextAsset filelist_obj = Resources.Load("patch_list"typeof(TextAsset)) as TextAsset;    
  16.     string[] filelist = filelist_obj.text.Split('\n');    
  17.     
  18.   
  19.     foreach (string original_path in filelist)    
  20.     {  
  21.         // *중요함! 개행 문자를 제거 해 줍니다.  
  22.         string path = original_path.Trim('\n');    
  23.         path = path.Trim('\r');    
  24.     
  25.         if (path.Length <= 0)    
  26.         {    
  27.             continue;    
  28.         }    
  29.   
  30.         // 확장자, 경로 다 빼고 파일 이름만 쏙 빼옵니다.    
  31.         int last_split_pos = path.LastIndexOf('/') + 1;    
  32.         int extend_length = path.Length - path.LastIndexOf('.');    
  33.         string filename = path.Substring(last_split_pos, (path.Length - last_split_pos) - extend_length);    
  34.   
  35.         // 번들 파일이 생성될 경로 입니다.
  36.         // 프로젝트 상위 폴더에 "patch/(플랫폼명)" 형태의 폴더를 미리 만들어 놓아야 합니다.
  37.         // 예)
  38.         // d:/project/patch/Android    <- 번들 파일이 생성될 폴더
  39.         // d:/project/gamecodi  <- 프로젝트 폴더
  40.         // d:/project/gamecodi/Assets
  41.         string output_path = string.Format("../patch/{0}/{1}.unity3d", target.ToString(), filename);    
  42.   
  43.         // 리스트에 기입된 경로에서 오브젝트를 로드합니다.  
  44.         string included_path = "Assets/" + path;    
  45.         UnityEngine.Object obj = Resources.LoadAssetAtPath(included_path, typeof(UnityEngine.Object));    
  46.         if (obj == null)    
  47.         {    
  48.             Debug.LogError("Cannot find the resource. " + included_path);    
  49.             continue;    
  50.         }    
  51.   
  52.         // 생성!  
  53.         BuildPipeline.BuildAssetBundle(obj, null, output_path,    
  54.             BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets,    
  55.             target);    
  56.     
  57.         Debug.Log("completed... : " + included_path);    
  58.     }    
  59. }    
파일 경로를 읽어온 뒤 개행 문자를 제거 해 주는것이 굉장히 중요합니다.
이것을 빼먹고 했더니 리소스 로딩이 실패나서 한참 고생했습니다.ㅠ_ㅠ

이렇게 만들어 놓고 플랫폼만 바꿔서 클릭 한번만 하면 되겠습니다.
끝~


Trackback 0 And Comment 0

[펌] 유니티엔진 - 유니티 스키닝 설정.

|

출처 : http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=on&ss=on&sc=on&keyword=%C0%AF%B4%CF%C6%BC&select_arrange=last_comment&desc=desc&no=311



안녕하세요.


오늘 새로 추가되는 세트옷 덕분에 유니티 스키닝에 대해 알게 되었네요 -ㅅ-;

다들 fbx 를 임포트 해서 prefab으로 만들어서 모델 데이터를 쓰고 계실겁니다.

프리팹을 열면 Skinned Mesh Renderer 이 있는데. 거기 속성중에.

Quality 라는 속성이 있습니다. 기본은  Auto 로 잡혀 있고요.

이 속성이 스키닝 본 개수를 설정 할 수 있습니다. 

기본 Auto로 잡을경우 2개. 1bone, 2bone, 4bone 선택이 가능합니다. (유니티 3.5.6기준)

유니티는 스키닝 계산을 cpu 에서 처리 하니깐, 모바일에서 써도 크게 문제는 되지 않을거 같네요 (정확한 프로파일링을 아직 못해봤네요..)

다른 사람들은 저처럼 삽질 하지 마세요 ㅠ.ㅠ


Trackback 0 And Comment 0

[펌] 유니티 안드로이드 빌링 api3 적용 팁입니다.

|

출처 : http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=on&ss=on&sc=on&keyword=%C0%AF%B4%CF%C6%BC&select_arrange=last_comment&desc=desc&no=291


안녕하세요.


게임 코디 눈팅 족이었다가, 저처럼 삽질 많이 하실분이 있을거 같아 이렇게 강좌를 쓰내요.

안드로이드 billing api3를 작업하면서, 유용한 플러그인 (prime31)을 쓸려고 했지만,

Purchase 의 Json이랑, Signature 정보를 안주드라고요 ㅠㅠ 

그래서 직접 구글 샘플을 가지고, 직접 이클립스 프로젝트에 코딩을 했습니다 (ctrl + c, ctrl + v)

예제 다 따라해서 안드로이드 샘플 코드 그대로 동작을 하면 잘 됩니다만..

이제 이벤트를 연결해서 , 아이템을 Purchage 성공 이벤트를 유니티에서 캡쳐해서, Java 의  Consume 함수 처리를 할때

앱이 중단 되는 사태가 나왔습니다. 

문제의 근원은  Consume 처리시, IabHelper의 consumeAsyncInternal 이 함수에서 핸들러를 만들고 쓰레드 를 생성해 처리를 하는데,

이렇게 쓰지 마시고. consumeAsyncInternal  에 MainActivity를 인자를 받으시고 runOnUiThread 로 작업을 수행하게 해주면 잘 동작됩니다.

이것때문에 결재 한 40번 넘게 테스트 한거 같내요.. 계속 패키지 빌드 하고, 기계에 심고 , 로그 보고 ㅠ


Trackback 0 And Comment 0

[펌] 유니티 엔진 팁 - 광고 모듈 붙이기

|
출처 : http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=on&ss=on&sc=on&keyword=%C0%AF%B4%CF%C6%BC&select_arrange=last_comment&desc=desc&no=277



[유니티 엔진 팁 - 광고 모듈 붙이기]

외부 광고모듈 적용.
- IOS : 해외버전은 apple의 iAD / 국내버전은 MezzoMedia라는 광고업체의 모듈을 사용하였습니다.
iAD는 자료찾기가 비교적 쉬웠고요, 국내업체의 광고모듈은 유니티엔진을 따로 지원하지는 않더군요.

- 삽질한부분...
xcode <-> 유니티 연동을 처음 하는거라 생각처럼 쉽게는 안되었음.
초기 프로젝트 설정할때는 수십개의 링크에러가 발생하여 멘붕상태가 되었는데요,
어떤 경우에는 xcode를 재시작하니 빌드오류가 싹 사라지는 경우도 있더군요.
그리고 유니티에서 빌드를 할때 xcode프로젝트가 다시 생성되면서 기존 파일들을 싹 지워버리는 경우도 있었습니다.

- 광고모듈이 계속 무한루프를 도는 현상.
처음에 광고를 딱 붙이고 올려보니 viewDidLoad함수가 끊임없이 호출되는 문제 발생했습니다.
구글링으로 해결방법을 찾아내어 loadView라는 빈 함수를 제거해주는것으로 해결했습니다.

- 불편했던점
xcode와 유니티를 전환해 가며 코딩해야하는 불편함이 있었습니다.
생소한 개발환경(visual studio처럼 익숙하지 않아서 빌드설정값 하나 찾는데도 애먹음).
개발/배포 인증서, 프로파일, 프로비저닝등 개념정립이 안되어서 재발급 받고 세팅하는것만 5~6번 반복하였음.

빌드 결과물인 .app파일이 순수 xcode native로 작업했을때 생기는 경로와 다른것도 걸림돌이었네요.
게다가 mac os업그레이드를 하고 나면 "라이브러리"폴더가 숨김설정 되어있기 때문에
이것을 풀어줘야 아웃풋 파일을 확인할 수 있습니다.
(실제 경로는 "라이브러리\Developer\..." 어딘가에 있음)
이런 사소한것 하나도 구글링해야 했기 때문에 시간도 지체되고 몸도 지쳐갔음.ㅠ_ㅠ



- Android : T-store의 T-ad를 사용하였음.
유니티용 모듈이 올라와 있지만 꼭 이걸 써야만 하는것은 아닙니다.
그냥 eclipse에 라이브러리 링크시켜 놓고 유니티와 연동하면 가능하거든요.

- 불편했던점
유니티에서 스크립트 작업만으로는 불가능하기 때문에 유니티activity소스를 긁어다가
eclipse에 붙여넣는등 번거로운 작업을 해야만 했습니다.
정보들이 인터넷 여기저기에 흩어져 있기 때문에 괜한 삽질을 한 적이 많았네요.

- 팁
adb logcat을 활용하여 디버깅 하면 도움이 많이 됩니다.
(폰 환경에서 돌렸을때 logcat이라는 프로그램을 통해서 PC화면에서 로그를 볼 수 있음)

activity가 따운되는 현상 및 클래스를 찾지 못하는 문제들이 자주 발생하였는데
대부분 라이브러리가 실행파일에 포함(?)되지 않아서 그런것입니다.
(포함이라는 용어가 맞는지는 모르겠지만 개념상 비슷하다고 했을때).
eclipse 빌드 설정에서 해당 라이브러리들을 아웃풋 파일에 넣어주는 옵션이 있습니다.

광고업체에서 보여줄 광고가 없을때는 아무것도 나오지 않기 때문에 
광고출력 위치에 땜빵할 UI를 넣어놓는것이 좋습니다. apple은 이것때문에 리젝걸기도 하더군요.


Trackback 0 And Comment 0