Unity3D - Sizuha/devdog GitHub Wiki
- ๋ฉ๋ด: Edit > Project Settings > Editor > (Inspector ์ฐฝ)
- ๋ฒ์ ๊ด๋ฆฌ ๋ชจ๋ ๋ณ๊ฒฝ: Version Control > Mode > Meta Files
- ์ ์ ์ง๋ ฌํ ๋ชจ๋ ๋ณ๊ฒฝ: Asset Serialization > Mode > Force Text
๋ค์ ๋ด์ฉ์ผ๋ก ํ๋ก์ ํธ ๋ฃจํธ ๋๋ ํ ๋ฆฌ์ .gitignore ํ์ผ์ ์์ฑ.
# Unity Folders
[Ll]ibrary/
[Tt]emp/
[Oo]bj/
# Autogenerated VS/MD solution and project files
*.csproj
*.unityproj
*.sln
*.suo
*.user
*.userprefs
*.pidb
*.booproj
# Unity3D Generated File On Crash Reports
sysinfo.txt
# Mac
.DS_Store
# Android
*.apk
*.obb
# Etc.
assetDatabase*
guidmapper
.~lock*
*.pyc
*.pyc.meta
- Q,W,E,R: Hand, Move, Rotate, Resize
- Option(Alt) : ํ๋ฉด ๊ฐ์ด๋ฐ๋ฅผ ๊ธฐ์ค์ผ๋ก ๋ทฐ๋ฅผ ํ์ .
- Option + Command: Hand
- ๋ง์ฐ์ค ๊ฐ์ด๋ฐ ๋ฒํผ: Hand
- Command + Shift + B: Build Settings
- Command + B: Build
์ง์ฐ๋ ค๋ ์ฌ์ ํด๋ฆญํด์ ์ ํํ ๋ค์, ํค๋ณด๋์ Deleteํค๋ฅผ ๋๋ฅธ๋ค.
http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
- UNITY_EDITOR
- UNITY_IOS
- UNITY_ANDROID
- UNITY_STANDALONE_OSX
- UNITY_STANDALONE_WIN
- UNITY_WEBPLAYER
// ๅฎ็พฉใใใฆใใใทใณใใซใๅๅพใใพใ
var defines = EditorUserBuildSettings.activeScriptCompilationDefines;
-
Application.isEditor
-
Application.isPlaying
-
Debug Build
if (Debug.isDebugBuild) {
Debug.Log("Yay!");
}
else {
Debug.Log("Booo...");
}
ํ๋ซํผ ํ์ธ์ Application.platform ํ์ฉ.
public static string getOSName() {
switch (Application.platform) {
case RuntimePlatform.Android:
return "android";
case RuntimePlatform.IPhonePlayer:
return "ios";
default:
return "other";
}
}
Application.systemLanguage ํ๋๋ฅผ ์ฐธ์กฐํ๋ค.
if (Application.systemLanguage == SystemLanguage.Korean) {
// TODO ...
}
์ฐ๋ ๊ธฐ ์์ง ์ง์
System.GC.Collect();
// Android
int verCode = UnityEditor.PlayerSettings.Android.bundleVersionCode;
// ๊ธฐํ.
string ver = UnityEditor.PlayerSettings.bundleVersion;
// iOS์์ OS ๋ฐ sdk ๋ฒ์ ํ์ธ
// UnityEditor.PlayerSettings.iOS ์ฐธ์กฐ.
๋ฐํ์์์๋ UnityEditor ๋ค์์คํ์ด์ค์ ์ ๊ทผ์ด ๋ถ๊ฐ๋ฅ ํ๋ค. ๊ฐ์ฅ ํ์คํ ๋ฐฉ๋ฒ์ ๋ค์ดํฐ๋ธ ํ๋ฌ๊ทธ์ธ์์ ๊ตฌํํ๋ ๊ฒ.
๊ทธ๋๋, ์ ๋ํฐ ์ฝ๋๋ง ๊ฐ์ง๊ณ ์ ๋ฒ์ ์ ๋ณด๋ฅผ ์์์ผ ๋ ํ์๊ฐ ์๋ค๋ฉด ๋ค์ ์ฝ๋๊ฐ ์ ์ฉํ ๋ฏ.
/* Assets/Editor/ ๊ฒฝ๋ก์ ์์น์ํฌ ๊ฒ. */
using UnityEngine;
using UnityEditor;
using System.IO;
[InitializeOnLoad]
public class BundleVersionChecker
{
/// <summary>
/// Class name to use when referencing from code.
/// </summary>
const string ClassName = "CurrentBundleVersion";
const string TargetCodeFile = "Assets/Scripts/Config/" + ClassName + ".cs";
static BundleVersionChecker () {
string bundleVersion = PlayerSettings.bundleVersion;
string lastVersion = CurrentBundleVersion.version;
if (lastVersion != bundleVersion) {
Debug.Log ("Found new bundle version " + bundleVersion + " replacing code from previous version " + lastVersion +" in file \"" + TargetCodeFile + "\"");
CreateNewBuildVersionClassFile (bundleVersion);
}
}
static string CreateNewBuildVersionClassFile (string bundleVersion) {
using (StreamWriter writer = new StreamWriter (TargetCodeFile, false)) {
try {
string code = GenerateCode (bundleVersion);
writer.WriteLine ("{0}", code);
} catch (System.Exception ex) {
string msg = " threw:\n" + ex.ToString ();
Debug.LogError (msg);
EditorUtility.DisplayDialog ("Error when trying to regenerate class", msg, "OK");
}
}
return TargetCodeFile;
}
/// <summary>
/// Regenerates (and replaces) the code for ClassName with new bundle version id.
/// </summary>
/// <returns>
/// Code to write to file.
/// </returns>
/// <param name='bundleVersion'>
/// New bundle version.
/// </param>
static string GenerateCode (string bundleVersion) {
string code = "public static class " + ClassName + "\n{\n";
code += System.String.Format ("\tpublic static readonly string version = \"{0}\";", bundleVersion);
code += "\n}\n";
return code;
}
}
SystemInfo.deviceUniqueIdentifier
์ฐธ์กฐ: http://tsubakit1.hateblo.jp/entry/20131028/1382965930
์ ๋ํฐ ํ๋ก์ ํธ์์ ์ฐธ์กฐ๋๋ ๋ชจ๋ ์ด์ ์์๋ค์ด ์ด๊ณณ์ ๋ค์ด๊ฐ๋ค.
Assets ๋๋ ํ ๋ฆฌ ํ์์ ๋ค์๊ณผ ๊ฐ์ ํน๋ณํ ๋๋ ํ ๋ฆฌ๋ฅผ ๋ ์ ์๋ค.
- Resources : ๊ฒ์์์ ๋์ ์ผ๋ก ์ฐธ์กฐ ๊ฐ๋ฅํ ๋ฆฌ์์ค๋ค. ํจํค์ง ๋น๋ ์์ ๋ฐ๋์ ๋น๋์ ํจ๊ป ํฌํจ๋๋ค.
- Editor : ์ ๋ํฐ ์๋ํฐ ์์์๋ง ์ ์ฉ๋๊ณ , ์ค์ ๋น๋์๋ ํฌํจ๋์ง ์๋๋ค. ์ฃผ๋ก ์๋ํฐ์ฉ ํ์ฅ ํ๋ฌ๊ทธ์ธ๋ค.
- Plugins : ๋ง๊ทธ๋๋ก ํ๋ฌ๊ทธ์ธ์ฉ ์ฝ๋ ํน์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ(DLL ๋ฑ)๋ค์ด ์์นํ๋ ๊ณณ. ๊ฐ ํ๋ซํผ๋ณ๋ก ์ ์ฉํ๊ธฐ ์ํด ์๋์ ๊ฐ์ ํ์ ๋๋ ํ ๋ฆฌ๋ฅผ ๋ง๋ค์ด ๋ ์ ์๋ค.
- Android
- iOS
- StreamingAssets : ๊ฒ์ ๋ด์์ OS์์ ํ์ผ ๊ฒฝ๋ก๋ฅผ ํตํด ์ฐธ์กฐ ๊ฐ๋ฅํ ๋ฆฌ์์ค๋ค์ด ์์นํ๋ ๊ณณ. ๋น์ฐํ ๋น๋ ํจํค์ง์ ํฌํจ๋๋ค. Resources ๋๋ ํ ๋ฆฌ์ ๋ค๋ฅธ ์ ์ ํจํค์ง ์์์ ๋ฒ๋ค๋ก ๋ฌถ์ด์ง ์๊ณ , ๊ฐ๊ฐ์ด ๊ฐ๋ณ ํ์ผ๋ก ๋ถ๋ฆฌ๋์ด ๋ค์ด๊ฐ๊ฒ ๋๋ค๋ ๊ฒ. ๋ค๋ง ๊ธฐ๋ณธ์ ์ผ๋ก Read Only ์ด๋ค.
์ ๋ํฐ ํ๋ก์ ํธ์์ ์ฌ์ฉ๋๋ ๋ชจ๋ ์ด์ ์ด ํฌํจ๋์ ๋น๋๋๋ ๊ฒ์ ์๋๋ค.
- ์ฐ์ Assets ๋๋ ํ ๋ฆฌ ์ดํ์ ๋ด์ฉ๋ฌผ๋ค์ด ํจํค์ง ๋์๋ค์ด๋ค.
- ๋ฐํ์ ๋ ์ฐธ์กฐ ํ ๊ฐ๋ฅ์ฑ์ด ์๋ ์ด์
๋ค์ ๋ฌด์กฐ๊ฑด ํจํค์ง์ ํฌํจ๋๋ค.
- Resources ๋ผ๋ ์ด๋ฆ์ผ๋ก๋ ๋๋ ํ ๋ฆฌ ์ดํ์ ๋ด์ฉ๋ฌผ์ ๋ฌด์กฐ๊ฑด ํจํค์ง ๋๋ค.
- StreamingAssets๋ ๋ง์ฐฌ๊ฐ์ง.
- ๋์ ์ผ๋ก ์ฐธ์กฐ๋์ง ์๋ ๋ฆฌ์์ค(๊ทธ๋ํฝ, ์ฌ์ด๋ ๋ฑ) ์ค์, ์ค์ ๋ก ์ด๋์์๋ ์ฌ์ฉ๋ ์ ์ด ์์ผ๋ฉด ํจํค์ง์๋ ํฌํจ๋์ง ์๋๋ค.
- ์ต์ ํ ์ต์ ์ด ์ผ ์๋ ๊ฒฝ์ฐ์๋ง ํด๋นํ๋ ๋ฏ.
- Editor ๋ผ๋ ์ด๋ฆ์ผ๋ก ๋ ๋๋ ํ ๋ฆฌ ์ดํ์ ๋ด์ฉ๋ฌผ์ ๊ธฐ๋ณธ์ ์ผ๋ก ํจํค์ง ๋์ง ์๋๋ค. ๋ค๋ง ๋ค์๊ณผ ๊ฐ์ ์์ธ๊ฐ ์๋ค.
- Resources ๋๋ ํ ๋ฆฌ ์ดํ์ Editor๋ผ๋ ๋๋ ํ ๋ฆฌ๊ฐ ์๋ ๊ฒฝ์ฐ๋ ์ ์ธ.
- ์ด๋๊ฐ์์ ์ ์ ์ผ๋ก ์ฐธ์กฐ๋๊ณ ์๋ ๋ฆฌ์์ค๊ฐ ์๋ค๋ฉด, Editor ๋๋ ํ ๋ฆฌ ์์ ๋ค์ด์์ด๋ ๋น์ฐํ ํจํค์ง์ ํฌํจ๋๋ค.
์ด ๊ท์น๋ค์ ์ ํ์ฉํ๋ฉด, ๋น๋ ํ ํจํค์ง์ ์ฉ๋์ ์ ์ปจํธ๋กค ํ ์ ์๋ค.
Unity Script ์ฐธ์กฐ.
- Unity ๊ฒ์๊ฐ๋ฐ ์ฐธ์กฐ.
- Unity 2D๊ฒ์ ์ฐธ์กฐ.
Unity ํ๋ซํผ ์ฐ๋ ์ฐธ์กฐ.
Unity ๋น๋ ์๋ํ ์ฐธ์กฐ.
์ด์ ๋ฒ๋ค ์ฌ์ฉ ๋ฐฉ๋ฒ์ Unity Asset Bundle ์ฐธ์กฐ.
Code Stripping ์์ C#์์ ์ ๊ณตํ๋ Security๊ด๋ จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ค์ด ์ ๋๋ก ๋์์ ์ ํ ์๋ ์๋ค.
Security ๊ด๋ จ ๊ธฐ๋ฅ์ ์ฌ์ฉํ ๋ ๋ฌธ์ ๊ฐ ์๊ธฐ๋ฉด, Stripping ์ต์
์ ํ๋ฒ ๊บผ ๋ณผ ๊ฒ.
AdFresca ๋ฑ์ jar ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํฌํจํด์ ์ฌ์ฉํ ๋, ์ด๋ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ์์ jar์ asset ๋ฆฌ์์ค๊ฐ ํฌํจ๋์ด ์๋ ๊ฒฝ์ฐ๊ฐ ์๋ค.
์ด๋๋ ๋ฐ๋์ jar ์์ถ์ ํ์ด์ ๊ด๋ จ ๋ฆฌ์์ค๋ฅผ ์ ๋ํฐ ํ๋ก์ ํธ Plugins/Android/assets ๊ฒฝ๋ก์ ๋ณต์ฌํด์ผ ํจ.
โป jar ๋์ aar ์ฌ์ฉ์ ๊ถํจ.
- Layout ๋ฉ๋ด์์ ๋ ์ด์์์ ๋ํดํธ๋ก ์ค์ .
- Layout ๋ฉ๋ด์์ ๋ ์ด์์ ๊ณต์ฅ ์ด๊ธฐํ ์งํ.
- Unity ์ฌ์์