블로그 이미지
Every unexpected event is a path to learning for you. blueasa

카테고리

분류 전체보기 (2847)
Unity3D (893)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (188)
협업 (64)
3DS Max (3)
Game (12)
Utility (141)
Etc (99)
Link (33)
Portfolio (19)
Subject (90)
iOS,OSX (52)
Android (16)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (19)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

개인적인 학습 목적으로 번역된 강좌글입니다. 

 

제 블로그로 링크가 되어 있는것은, 이쪽으로 번역글을 옮기는 과정이 번거롭고

비효율적이기 때문에 그렇고, 결코 블로그 홍보를 목적으로 하지 않습니다.

 

다른 곳에 퍼가신다면 일본어 원문 링크를 꼭 표기하여 주시기 바랍니다.

 

유니티 에디터에서 기본 제공되는 에디터 UI에서 더 나아가 직접 커스터마이즈하고

툴을 만들기 위해 필요한 정보들을 담고 있습니다.

 

원문

http://anchan828.github.io/editor-manual/web/index.htmlViewer

 

1장 에디터 확장에서 사용하는 폴더Viewer

2장 표준에서 사용할 수 있는 에디터 확장기능Viewer

3장 데이터 저장Viewer

4장 ScriptableObjectViewer

5장 SerializedObject에 대해서Viewer

6장 EditorGUIViewer

7장 EditorWindowViewer

8장 MenuItemViewer

9장 CustomEditorViewer

10장 PropertyDrawerViewer

11장 ProjectWindowUtilViewer

12장 Undo에 대해서Viewer

13장 다양한 이벤트의 콜백Viewer

14장 ReorderbleListViewer

15장 ScriptTemplatesViewer

16장 Gizmo(기즈모)Viewer

17장 Handle(핸들)Viewer

18장 HierarchySortViewer

19장 GUI를 직접 만들기Viewer

20장 OverwriterViewer

21장 파티클을 제어하기Viewer

22장 SpriteAnimationPreview(스프라이트 목록의 표시)Viewer

23장 SpriteAnimationPreviwe(스프라이트 애니메이션)Viewer

24장 씬 Asset에 스크립트를 AttachViewer

25장 시간을 제어하는 TimeControlViewer

26장 AssetDatabaseViewer

27장 HideFlagsViewer

28장 AssetPostprocessorViewer(완)



[출처] http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_Lecture&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=hit&desc=asc&no=477

반응형
Posted by blueasa
, |


[Free Asset] https://assetstore.unity.com/packages/tools/utilities/keystore-helper-58627


using UnityEngine;
using UnityEditor;
using System.IO;
 
[InitializeOnLoad]
public class PreloadSigningAlias
{
 
    static PreloadSigningAlias ()
    {
        PlayerSettings.Android.keystorePass = "KEYSTORE_PASS";
        PlayerSettings.Android.keyaliasName = "ALIAS_NAME";
        PlayerSettings.Android.keyaliasPass = "ALIAS_PASSWORD";
    }
 
}



[출처] https://forum.unity.com/threads/android-keystore-passwords-not-saved-between-sessions.235213/

반응형
Posted by blueasa
, |


[MenuItem("AssetBundles/Set Asset Bundle From File Name",false, 0)]
static void SetAssetBundlesFromFileNames()
{
	if (Selection.assetGUIDs.Length > 0) {
		foreach (ObjectassetinSelection.objects) {
			string path = AssetDatabase.GetAssetPath(asset);
			AssetImporter assetImporter = AssetImporter.GetAtPath(path);
			assetImporter.assetBundleName = asset.name;
			Debug.Log(Selection.assetGUIDs.Length + " Asset Bundles Assigned");
		}
	} else {
		Debug.Log ("No Assets Selected");
	}
}



[출처] https://forum.unity.com/threads/set-asset-bundle-name-form-editor-menu-item-script.333297/

반응형
Posted by blueasa
, |

앱 실행 시, 타 앱(멜론이나 벅스뮤직 등)의 백그라운드에서 재생되는 음원을 끄게 할 수 없냐고 말이나와서 권한 문제로 안될 줄 알았는데..

유니티 셋팅에 보니 PlayerSettings-Other Settings에 Mute Other Audio Sources 옵션이 있다.


켜주니 타 앱 사운드가 잘 꺼진다.


  [Android 주의사항]

Android Marshmallow (6.0) 이상은 READ_PHONE_STATE permission을 추가해줘야 된다고 한다.




[출처] https://stackoverflow.com/questions/39080989/unity-app-stops-background-music


[참조] https://docs.unity3d.com/ScriptReference/PlayerSettings-muteOtherAudioSources.html

[참조] http://jwandroid.tistory.com/153

반응형
Posted by blueasa
, |

[TroubleShooting]


[에러메시지]

NotSupportedException: .... System.Net.WebRequest.GetCreator (System.String prefix) System.Net.WebRequest.Create (System.Uri requestUri)


PC/iOS에서는 잘 되는데 Android에서 위와 같은 NotSupportedException이 난다.(현재 Unity v5.6.5f1)

검색해보니 게임코디에 아래와 같은 답변을 해주신 분이 있다.



  비회원: 
kimsama

NotSupportedException: .... System.Net.WebRequest.GetCreator (System.String prefix) System.Net.WebRequest.Create (System.Uri requestUri) 모바일에서 위의 에러로 인해 HttpWebReaquest 를 사용하지 못하는 경우라면 여기 링크의 내용 참고하시기 바랍니다. http://www.vovchik.org/blog/13001 간단하게 우회하는 방법이 나와 있습니다.

[출처] http://lab.gamecodi.com/board/zboard.php?id=GAMECODILAB_QnA_etc&page=2&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=2617



그래서 링크(http://www.vovchik.org/blog/13001)에서 말해준 대로 Wrapping을 해서 Android에서 돌려보니 잘된다!!

(kimsama님 감사합니다!)


내가 추가 및 수정한 소스는 아래와 같다.


// Wrapper Class
using System;
using System.Net;

public class HttpRequestCreator : IWebRequestCreate 
{
	public WebRequest Create(Uri uri)
	{
		return new HttpWebRequest(uri);	
	}
}


    //Get size of the asset
    HttpRequestCreator cHttpRequestCreator = new HttpRequestCreator();            // modify
    System.Net.WebRequest req = cHttpRequestCreator.Create(new Uri(assetURL));    // modify
    req.Method = "HEAD";

    float ContentLength;
    using (System.Net.WebResponse resp = req.GetResponse())
    {
        float.TryParse(resp.ContentLength.ToString(), out ContentLength);
    }

    while (!download.isDone)
    {
        if (progressBar != null)
	    {
            progressBar.LabelInformations = "Downloading Assets";
            progressBar.Progress = download.progress;
            progressBar.AssetSize = ContentLength / 1000000; //(Mb)
	    }
	    yield return null;
    }






- CDN에 있는 파일 사이즈를 어떻게 알 수 없나 하고 찾다가 테스트 해보고 잘 되길래 올려 놓음.

  (PC/iOS는 잘되는데 Android가 에러나서 위와 같이 고침)

    1. //Get size of the asset
    2. System.Net.WebRequest req = System.Net.HttpWebRequest.Create(assetURL);
    3. req.Method = "HEAD";
    4. float ContentLength;
    5. using (System.Net.WebResponse resp = req.GetResponse())
    6. {
    7. float.TryParse(resp.ContentLength.ToString(), out ContentLength);
    8. }
    9. while (!download.isDone)
    10. {
    11. if (progressBar != null)
    12. {
    13. progressBar.LabelInformations = "Downloading Assets";
    14. progressBar.Progress = download.progress;
    15. progressBar.AssetSize = ContentLength / 1000000; //(Mb)
    16. }
    17. yield return null;
    18. }


[출처] https://answers.unity.com/questions/1035361/get-size-of-an-online-assetbundle-and-progress-in.html




반응형
Posted by blueasa
, |

앞서 정리한 스탑코루틴의 활용 1의 내용으로 개념을 잡고 넘어가자.

 

 

코루틴 호출은 script.StartCoroutine() 으로 호출하게 되어있고,

앞부분을 생략하고 StartCoroutine()으로 호출하면

자동적으로 콜링한 스크립트에서 제어하는 코루틴으로 호출되도록 되어있다.

 

즉 StartCoroutine( ~~~ ) 를 포함하여 코루틴을 호출하면 이 코루틴은 자신을 콜링한 스크립트가 달려있는 게임오브젝트에 할당되는 것이다.

 

이것이 적용되어 해당 게임오브젝트를 disable시키면,

그 게임오브젝트에 할당되어 돌아가던 모든 코루틴은 정지된다. (StopAllCoroutine의 효과)

 

 

 

 

 

<예시1>

 

 

위의 그림을 참고하자.

 

위 그림은 이런 상황을 거친 결과다

Scr Main===

 start()

{

StartCoroutine(A);

}

 

Scr Manager====

{

GameObj1.GetComponent<Scr Main>().StartCoroutine(B);

GameObj2.GetComponent<Scr Main>().StartCoroutine(B);

 

GameObj1.GetComponent<Scr Main>().StartCoroutine(C);

GameObj2.GetComponent<Scr Sub>().StartCoroutine(C);

}

 

1. Main 스크립트는 생성되면서 동시에 코루틴A를 호출한다. 그래서 Main 스크립트가 붙어있는 게임오브젝트1,2에서 각각 시작되었다.

 

2 Manager에서 게임오브젝트1의 Main에 B와 C를 호출했다. (타 오브젝트, 타 스크립트에서 호출한 경우 )

이 때는 Manager의 게임오브젝트에 할당되지않고 호출타겟을 찾아간다.

마찬가지로 게임오브젝트 2 에는 Main에 코루틴B를, Sub에 코루틴 C를 호출하였다.

 

그 결과 위의 그림처럼 코루틴이 붙어 있게 된 모양.

 

 

 

Q. 여기서 게임오브젝트1의 Main에서 올스탑 코루틴을 콜하거나, 게임오브젝트 1번을 disable하면 어떻게 될까?

A. 게임오브젝트1의 코루틴 A,B,C가 종료된다.

 

Q. 게임오브젝트2를 disable 한다면?

A. 게임오브젝트의 Main의 A,B와 Sub의 C가 모두 종료된다.

 

Q. 임오브젝트2의 Main에서 StopAllCoroutine()을 호출한다면?

A. 게임오브젝트2의 Main의 A,B만 종료되고 Sub의 C는 살아있다.

 

 

위 상황만으로도 어느정도 코루틴들이 어떤 오브젝트의 어느스크립트에 포함되어 돌아가는가 유추할수 있다.

어려운 부분이 있다면 비슷한 내용으로 테스트를 해보길 바란다.

 

 

 

 

이러한 내용을 설명한 이유는 

코루틴에는 정립해야할 내용이 하나 더 있기 때문이다.

 

코루틴이 어떤 스크립트에 매칭되어 있는가 머리속에 그려진다면 스크립트에서 다른오브젝트의 스크립트의 코루틴을 호출하여 가지고 있을수 있다는 것을 알수 있다.

 

 

예를 들면

Scr A에서 선언한 변수 co가 있다고 해보자. 

 

coroutine co = GameObj1.GetComponent<Scr Main>().StartCoroutine(B);

 

위와같이 변수에 다른오브젝트 코루틴을 담아두었다.

 

Q.이것을 멈추기 위해서 어떻게 하겠는가?

 

StopCoroutine( co );

라고 생각하기 쉽지만, 이렇게 멈추게 되면 (코루틴이 멈추긴 한다)  

 

Coroutine continue failure  라는 에러메세지 가 발생한다.

 

정확하게 멈추기 위해서는

 

GameObj1.GetComponent<Scr Main>().StopCoroutine( co );

 

과 같이 코루틴이 할당된 스크립트에서 스탑을 시켜줘야한다.

 

 

위의 에러메세지가 나타나는 이유는 다른스크립트에서 코루틴을 스탑시키면 코루틴은 멈추지만,

기존에 코루틴을 돌리고 있던 스크립트에서 다른동작을 하고 다시 코루틴을 찾아올때 (코루틴은 IEnumerator 로 돌아간다)

이미 코루틴이 사라져서 찾을수 없게 되기 때문인것 같다.

(정확한 이유를 알기 위해선 유니티 엔진 내부를 보아야 할것이다) 



출처: http://qits.tistory.com/entry/StopCoroutine-의-활용-2-Coroutine-continue-failure [Quiet, In The Storm...]

반응형
Posted by blueasa
, |
Here is an advanced version, Just for fun. :p
Features
  • Multiple Define Symbols
  • Safety
  • Runs when Compile ends
  • Removes Duplicates
Installation
  1. Download the Script or Copy/Paste it from the Below
  2. Open Script
  3. Go to Symbols property and add your own symbols
  4. Go back to Unity and wait for compile ends
  5. All done, now check Player Settings, The symbols added
Code (CSharp):
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using UnityEngine;
  5. using UnityEditor;
  6.  
  7. /// <summary>
  8. /// Adds the given define symbols to PlayerSettings define symbols.
  9. /// Just add your own define symbols to the Symbols property at the below.
  10. /// </summary>
  11. [InitializeOnLoad]
  12. public class AddDefineSymbols : Editor
  13. {
  14.  
  15.     /// <summary>
  16.     /// Symbols that will be added to the editor
  17.     /// </summary>
  18.     public static readonly string [] Symbols = new string[] {
  19.         "MYCOMPANY",
  20.         "MYCOMPANY_MYPACKAGE"
  21.     };
  22.  
  23.     /// <summary>
  24.     /// Add define symbols as soon as Unity gets done compiling.
  25.     /// </summary>
  26.     static AddDefineSymbols ()
  27.     {
  28.         string definesString = PlayerSettings.GetScriptingDefineSymbolsForGroup ( EditorUserBuildSettings.selectedBuildTargetGroup );
  29.         List<string> allDefines = definesString.Split ( ';' ).ToList ();
  30.         allDefines.AddRange ( Symbols.Except ( allDefines ) );
  31.         PlayerSettings.SetScriptingDefineSymbolsForGroup (
  32.             string.Join ( ";", allDefines.ToArray () ) );
  33.     }
  34.  
  35. }
Thanks.




[출처] https://forum.unity.com/threads/scripting-define-symbols-access-in-code.174390/

반응형
Posted by blueasa
, |


[Link] https://github.com/zeyangl/UnityAppNameLocalizationForIOS


[참조] https://answers.unity.com/questions/789428/how-to-add-languages-automatically-when-you-export.html



반응형

'Unity3D > Plugins' 카테고리의 다른 글

[링크] Emoji_Extension  (0) 2018.06.07
[펌] Background Worker for Unity3D  (0) 2018.06.01
[에셋] Anti-Cheat Toolkit  (0) 2018.03.06
[펌] UnityIPhoneXSupport  (0) 2017.11.10
[Link] unity-webview  (0) 2017.10.23
Posted by blueasa
, |
반응형
Posted by blueasa
, |
반응형
Posted by blueasa
, |