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

카테고리

분류 전체보기 (2738)
Unity3D (817)
Script (91)
Extensions (14)
Effect (3)
NGUI (77)
UGUI (8)
Physics (2)
Shader (36)
Math (1)
Design Pattern (2)
Xml (1)
Tips (200)
Link (22)
World (1)
AssetBundle (25)
Mecanim (2)
Plugins (70)
Trouble Shooting (68)
Encrypt (7)
LightMap (4)
Shadow (4)
Editor (8)
Crash Report (3)
Utility (9)
UnityVS (2)
Facebook SDK (2)
iTween (3)
Font (11)
Ad (14)
Photon (2)
IAP (1)
Google (8)
Android (45)
iOS (41)
Programming (475)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
05-03 00:02


링크 : http://www.slideshare.net/MrDustinLee/ss-27739454

반응형
Posted by blueasa
, |


[Active/InActive HotKey for NGUI]

Alt + Shift + A



[출처] http://www.youtube.com/watch?v=uNSZsMnhS1o



[추가1]

https://answers.unity.com/questions/566114/is-there-a-keyboard-shortcut-for-setting-an-object.html



[추가2]

Unity2018에서 해당 키가 안먹힘

원래 NGUI 부가기능인데 유니티가 좋아보였는지 내장시켰다고 함.

그래서 양쪽에서 같은 Hotkey를 셋팅했기 때문에 충돌나서 키가 안먹힌다고 함.

유니티에 내장됐기 때문에 NGUI의 Hotkey 소스를 주석처리 하자.


NGUISelectionTools.cs

에 보면 

[MenuItem("GameObject/Selection/Toggle 'Active' #&a")]

부분이 있는데

해당 MenuItem 부분만 주석처리하면 됨.


[출처] 게임코디 선후님

반응형
Posted by blueasa
, |

출처 - http://docs.unity3d.com/Documentation/Manual/iphone-playerSizeOptimization.html -


iOS 플레이어 빌드 사이즈 최적화 하기.

빌드 사이즈를 줄이는 방법은 크게 두 가지가 있습니다. Xcode에서 Active Build Configuration을 조절하는 방법과 Unity에서 Stripping Level을 조절하는 방법입니다.

 

Relese Mode로 빌드 하기.

Xcode에서 빌드 할 때Active Build Configuration 드롭다운 메뉴에서 Debug 와 Release 옵션을 선택할 수 있습니다. Debug Mode 대신 Release Mode로 빌드를 하면 게임에 따라서 2-3MB 정도의 빌드 크기가 줄어듭니다.

1.jpg

The Active Build Configuration drop-down -

Release Mode로 빌드를 하게 되면 Debug 정보 없이 빌드를 하기 때문에게임이 크래쉬가 발생하거나 다른 문제가 생겼을 때 Stack Trace 등의 정보를Output으로 확인할 수가 없습니다

제작이 완료돼서 배포를 하는 게임의 경우에는 문제가 되지 않겠지만개발 중에는 Debug Mode가 유용합니다.


iOS Stripping Level (Advanced License feature)

Stripping Level 을 조절해서 빌드 크기를 최적화 하는 방법은 아래와 같은 방법으로 진행이 됩니다.

1. Strip assemblies level: 스크립트의 Bytecode를 분석해서해당 클래스와 메소드가 참조가 되는지 여부를 확인하고참조되지 않는 부분은 DLL에서 제거되고, AOT 컴파일 단계에서 제외 됩니다이 최적화 방법은 Main binary의 크기와 수반되는 DLL을 줄이는 방법으로리플렉션을 사용하지 않는 한 안전한 방법입니다.

2. Strip ByteCode level: (Data 폴더에 저장되는)모든 .Net DLLmetadata strip되어 크기가 줄어듭니다모든 코드가 AOT 단계에서 미리 전처리(precompiled)가 되고, main binary에 링크가 되기 때문에 이 방법이 가능하게 됩니다.

3. Use micro mscorlib: 특별한 경우로, mscorlib smaller 버전을 사용하는 방법입니다.

이 라이브러리에서는 일부 컴포넌트가 제외된 버전입니다.

예를 들어, Security, Reflection.Emit, Remoting, non Gregorian calendars 등이 제외됩니다.

또한 내부 컴포넌트간의 상호의존성이 줄어들게 됩니다이 방법은 main binary mscorlib.dll의 크기를 줄이는 방법이지만 일부 System 및 System.Xml 어셈블리 클래스에서는 호환이 되지 않으니 주의를 해야 합니다.

 Level들은 축적이 됩니다다시 말해서, Level 3 최적화 방법은 Level 2  Level 1을 내포하고, Level 2 최적화 방법은 Level 1을 포함합니다.

주의: Micro mscorlib  core 라이브러리의 크기를 많이 줄인 버전입니다. micro mscorlib 를 사용할 때 가장 좋은 방법은 제작중인 어플리케이션에서 사용하지 않는 .Net 클래스와 기능들을 사용하지 않는 것입니다제외할 예로 GUID가 가장 좋은 예시가 될 것 같습니다. GUID를 직접 만들어서 대체 사용이 쉽고직접 제작해서 사용하는 경우 성능 면에서 앱 사이즈를 줄이는 면에서도 모두 좋은 결과를 낼 수 있습니다.


Tips

리플렉션을 사용할 때 Stripping 조절하는 방법

Stripping static code analysis에 많이 의존하는 방법이기 때문에효율적으로 진행이 되지 않는 경우가 종종 발생합니다.

한 예로 리플렉션과 같은 dynamic 기능이 사용되는 경우입니다이런 경우사용하거나 참조해야 하지 않는 클래스 등을 명시 하는 것이 필수적입니다.

유니티는 프로젝트 별로 따로 custom stripping blacklist를 지원합니다. blacklist를 사용하면 link.xml 파일을 생성하고 Assets 폴더에 두어야 합니다. link.xml 파일의 예제를 아래에서 확인할 수 있습니다보존(preservation)되어야 한다고 명시된 클래스들은 stripping에 영향을 받지 않게 됩니다.

<linker>

       <assembly fullname="System.Web.Services">

               <type fullname="System.Web.Services.Protocols.SoapTypeStubInfo" preserve="all"/>

               <type fullname="System.Web.Services.Configuration.WebServicesConfigurationSectionHandler" preserve="all"/>

       </assembly>

 

       <assembly fullname="System">

               <type fullname="System.Net.Configuration.WebRequestModuleHandler" preserve="all"/>

               <type fullname="System.Net.HttpRequestCreator" preserve="all"/>

               <type fullname="System.Net.FileWebRequestCreator" preserve="all"/>

       </assembly>

 </linker>

주의하지만 어떤 클래스가stripping 되어야 하고 어떤 클래스가 사용이 되어야 하는지를 판별하는 방법이 어려울 수 있기 때문에, Xcode 콘솔의 에러 메시지를 확인하고시뮬레이터에서 앱을 실행시켜서 그런 정보들을 확인하는 것이 필요할 수 있습니다.

최적화된 크기의 앱 배포를 위한 체크리스트

1. 에셋 줄이기텍스처에 PVRTC 압축 옵션을 활성화 하고 가능한 범위 내에서 해상도를 줄입니다또한압축되지 않은 사운드 에셋의 수를 줄입니다이 방법에 대한 추가 팁을 아래 링크에서 확인할 수 있습니다. (링크 - http://docs.unity3d.com/Documentation/Manual/ReducingFilesize.html)

2. iOS Stripping Level Use Micro mscorlib로 설정합니다.

3. 스크립트 호출 최적화Level Fast but no exceptions로 설정합니다.

(Script call optimization level)

4. System.dll System.Xml.dll 에 있는 기능들은 사용하지 않습니다

이 라이브러리들은 micro mscorlib에 호환되지 않는 것 들입니다.

5. 불필요한 code dependencies를 제거합니다.

6. API Compatibility Level .Net 2.0 subset으로 설정합니다.

하지만 .Net 2.0 subset은 다른 라이브러리들과의 호화성에 제한적인 부분이 있다는 점을 주의해야 합니다

7. Target platformarm6로 설정합니다. (OpenGL ES 1.1)

8. JS Arrays를 사용하지 않습니다.

9. 구조체를 포함해서 Value 타입과 조합해서 generic container를 사용 하는 것을 자제합니다.



반응형
Posted by blueasa
, |

[추가] 2024-04-17

#define으로 Editor, Device등 원하는 곳에 띄울 수 있게 약간 변형함

#if UNITY_EDITOR
#define MY_DEBUG
#endif

using UnityEngine;
using System.Collections;
using System;
using UnityEngine.Internal;


/// 
/// It overrides UnityEngine.Debug to mute debug messages completely on a platform-specific basis.
/// 
/// Putting this inside of 'Plugins' foloder is ok.
/// 
/// Important:
///     Other preprocessor directives than 'UNITY_EDITOR' does not correctly work.
/// 
/// Note:
///     [Conditional] attribute indicates to compilers that a method call or attribute should be 
///     ignored unless a specified conditional compilation symbol is defined.
/// 
/// See Also: 
///     http://msdn.microsoft.com/en-us/library/system.diagnostics.conditionalattribute.aspx
/// 
/// 2012.11. @kimsama
///

/// - Unity 5.x 대응(5.x에 추가된 Debug 함수 추가)
/// - isDebugBuild("Development Build") 시 return.
/// 2016-07-25 by blueasa

public static class Debug
{
    public static bool developerConsoleVisible
    {
        get { return UnityEngine.Debug.developerConsoleVisible; }
    }

    public static bool isDebugBuild
    {
        //get { return UnityEngine.Debug.isDebugBuild; }
#if MY_DEBUG
        get { return true; }
#else
        get { return false; }
#endif
    }

    public static ILogger logger
    {
        get { return UnityEngine.Debug.unityLogger; }
    }

    public static void Assert(bool condition)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Assert(condition);
    }

    public static void Assert(bool condition, string message)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Assert(condition, message);
    }

    public static void Assert(bool condition, object message)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Assert(condition, message);
    }

    public static void Assert(bool condition, UnityEngine.Object context)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Assert(condition, context);
    }

    public static void Assert(bool condition, string message, UnityEngine.Object context)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Assert(condition, message, context);
    }

    public static void Assert(bool condition, object message, UnityEngine.Object context)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Assert(condition, message, context);
    }

    public static void AssertFormat(bool condition, string format, params object[] args)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.AssertFormat(condition, format, args);
    }

    public static void AssertFormat(bool condition, UnityEngine.Object context, string format, params object[] args)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.AssertFormat(condition, context, format, args);
    }

    public static void Break()
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Break();
    }

    public static void ClearDeveloperConsole()
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.ClearDeveloperConsole();
    }

    public static void DebugBreak()
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DebugBreak();
    }

    public static void DrawLine(Vector3 start, Vector3 end)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawLine(start, end);
    }

    public static void DrawLine(Vector3 start, Vector3 end, Color color)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawLine(start, end, color);
    }

    public static void DrawLine(Vector3 start, Vector3 end, Color color, float duration)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawLine(start, end, color, duration);
    }

    public static void DrawLine(Vector3 start, Vector3 end, [DefaultValue("Color.white")] Color color, [DefaultValue("0.0f")] float duration, [DefaultValue("true")] bool depthTest)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawLine(start, end, color, duration, depthTest);
    }

    public static void DrawRay(Vector3 start, Vector3 dir)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawRay(start, dir);
    }

    public static void DrawRay(Vector3 start, Vector3 dir, Color color)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawRay(start, dir, color);
    }

    public static void DrawRay(Vector3 start, Vector3 dir, Color color, float duration)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawRay(start, dir, color, duration);
    }

    public static void DrawRay(Vector3 start, Vector3 dir, [DefaultValue("Color.white")] Color color, [DefaultValue("0.0f")] float duration, [DefaultValue("true")] bool depthTest)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.DrawRay(start, dir, color, duration, depthTest);
    }

    public static void Log(object message)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Log(message);
    }

    public static void Log(object message, UnityEngine.Object context)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.Log(message, context);
    }

    public static void LogAssertion(object message)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogAssertion(message);
    }

    public static void LogAssertion(object message, UnityEngine.Object context)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogAssertion(message, context);
    }

    public static void LogAssertionFormat(string format, params object[] args)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogAssertionFormat(format, args);
    }

    public static void LogAssertionFormat(UnityEngine.Object context, string format, params object[] args)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogAssertionFormat(context, format, args);
    }

    public static void LogError(object message)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogError(message);
    }

    public static void LogError(object message, UnityEngine.Object context)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogError(message, context);
    }

    public static void LogErrorFormat(string format, params object[] args)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogErrorFormat(format, args);
    }

    public static void LogErrorFormat(UnityEngine.Object context, string format, params object[] args)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogErrorFormat(context, format, args);
    }

    public static void LogException(Exception exception)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogException(exception);
    }

    public static void LogException(string exception)
    {
        Exception ex = new Exception(exception);
        UnityEngine.Debug.LogException(ex);
    }

    public static void LogException(Exception exception, UnityEngine.Object context)
    {
        //if (false == isDebugBuild)
        //    return;

        UnityEngine.Debug.LogException(exception, context);
    }

    public static void LogFormat(string format, params object[] args)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.LogFormat(format, args);
    }

    public static void LogFormat(UnityEngine.Object context, string format, params object[] args)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.LogFormat(context, format, args);
    }

    public static void LogWarning(object message)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.LogWarning(message);
    }

    public static void LogWarning(object message, UnityEngine.Object context)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.LogWarning(message, context);
    }

    public static void LogWarningFormat(string format, params object[] args)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.LogWarningFormat(format, args);
    }

    public static void LogWarningFormat(UnityEngine.Object context, string format, params object[] args)
    {
        if (false == isDebugBuild)
            return;

        UnityEngine.Debug.LogWarningFormat(context, format, args);
    }
}

 

 

 

----

Unity에서 프로그래밍할 때 콘솔에 디버깅이나 경고 혹은 에러 문자열 출력을 위해서 Debug.Log 의 메시지 출력 메소드를 많이 사용합니다. 
 
문제는 Debug.Log 메소드의 이름과 달리 해당 콘솔 출력이 디바이스에 deploy해서 실행할 때에도 실행이 된다는 점입니다. 
 
처음부터 Debug.Log 메시지를 대체하는 별도의 wrapper 클래스나 메소드를 작성해서 사용한 경우라면 문제가 되지 않지만, 프로젝트 내에 이미 수 많은 Debug.Log 메시지들이 존재하는 경우, 변경이 번거로울 수 있습니다. 
 
이 때 사용할 수 있는 간단한 방법이 .NET의 System.Diagnostics.Conditional 속성을 사용하는 것입니다.
 
public static class Debug
{ 
[System.Diagnostics.Conditional("UNITY_EDITOR")]
public static void Log (object message)
{
UnityEngine.Debug.Log (message);
}
}
 
전체 코드는 아래 링크의 gist에서 확인할 수 있습니다.
 
 
Debug 클래스에는 Debug.Log 뿐만 아니라 UnityEngine.Debug 클래스의 DrawLine, DrawRay 등을 포함한 모든 메소드들에 대한 대체 메소드들을 포함하고 있습니다.
 
사용 방법은 링크의 전체 코드를 Assets 폴더 내의 Editor 폴더에 저장하면 됩니다.
사용 방법은 링크의 전체 코드를 Assets 폴더 내의 Plugins 폴더에 저장하면 됩니다.

 

 

[출처] http://www.unitystudy.net/bbs/board.php?bo_table=writings&wr_id=60&page=0&sca=&sfl=&stx=&spt=0&page=0&cwin=#c_322

 

 

 

[추가][Unity 5.3 이상]

It works.
And, Unity 5.3 provides an easier solution: Debug.logger.logEnabled=false to disable it.



[출처] https://gist.github.com/kimsama/4123043

 

반응형
Posted by blueasa
, |


1-1. 유니티 안드로이드 플러그인 만들기 - Android 개발 환경 구축 하기 - JDK 설치 및 윈도우 설정 


1-2. 유니티 안드로이드 플러그인 만들기 - Android 개발 환경 구축 하기 - Android SDK 설치 및 eclipse 설치 


1-3. 유니티 안드로이드 플러그인 만들기 - Unity 안드로이드 빌드


1-4. 유니티 안드로이드 플러그인 만들기 - Unity 안드로이드 Plugin 만들기




안드로이드플러그인.docx


반응형
Posted by blueasa
, |

Texture Sizes

Ideally texture sizes should be powers of two on the sides. These sizes are as follows: 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 etc. pixels. The textures do not have to be square, i.e. width can be different from height. Note that each platform may impose maximum texture sizes.


Android

Unless you're targeting a specific hardware, like Tegra, we'd recommend using ETC1 compression. If needed you could store an external alpha channel and still benefit from lower texture footprint. If you absolutely want to store an alpha channel in a texture, RGBA16 bit is the compression supported by all hardware vendors.


Textures can be imported from DDS files but only DXT or uncompressed pixel formats are currently supported.

 

If your app utilizes an unsupported texture compression, the textures will be uncompressed to RGBA 32 and stored in memory along with the compressed ones.So in this case you lose time decompressing textures and lose memory storing them twice. It may also have a very negative impact on rendering performance.

 

중요한부분에 빨간마커!

 

요약 : 

 

플랫폼별 텍스쳐사이즈 리미트를 확인

암축설정은 ETC1 할것이유인 즉슨 ETC1 모든 기기에서 지원하는데만약 지원하지않는 압축형식을 사용할경우 텍스쳐는 32bit형식으로 압축이 풀리면서 메모리가 졎대는 현상이 발생함

 

추가 :

2^x*2^x정방형태의 텍스쳐를 사용할것



[출처] Unity3d Texture 레퍼런스정리|작성자 송주씨


반응형
Posted by blueasa
, |

전문 : http://www.imaso.co.kr/?doc=bbs/gnuboard.php&bo_table=article&wr_id=41284



[요약]

● 시스템 메모리
1. 메모리 프로파일러(Instruments, DDMS)를 늘 곁에 두고 지낸다.
2. 모노 런타임에 기인한 메모리 릭이 발생할 수도 있다는 사실을 기억한다.
3. 모노 런타임 분석에도 도전해 본다.

● 비디오 메모리
1. 어떠한 경우에서라도 NPOT 텍스처를 피한다.
2. OpenGL ES Profiler와 친해진다.
3. 가능하다면 텍스처 압축을 사용한다.
4. 지금 선택한 텍스처의 color bit이 적절한지 다시 생각해 본다.

반응형
Posted by blueasa
, |
애플의 공식적인 문서는 아니고, Skyler Saleh 의 개인적인 경험에 의한 수치라고 함.
참조해야지..

  • 260 MB of ram on iPad 2 (Thanks RobCroll)
  • 170-180MB of ram on devices with 512 Mb of ram total (iPhone 4, iPod touch 4g)
  • 40-80MB of ram on devices that have 256 MB of ram (iPad, iPhone 3gs, iPod touch 3g)
  • 25 MB on device with only 128MB of ram (IPhone 3g, iPhone 2g, iPod touch 1g-2g)


출처 : http://stackoverflow.com/questions/6044147/memory-limit-and-ios-memory-allocation-in-iphone-sdk

반응형

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

Unity3d Texture 레퍼런스정리  (0) 2013.07.03
유니티 메모리 최적화  (0) 2013.07.03
Max Texture Size of iOS Devices  (0) 2013.06.14
게임 중 일시정지 하기  (0) 2013.05.30
Random.Range(min, max) 함수의 max값에 대해..  (0) 2013.05.21
Posted by blueasa
, |

Max Texture Size of iOS Devices

When loading OpenGL textures (or sprites, sprite sheets in Cocos2d), the max size for

1024 x 10242048 x 20484096 x 4096
iPhone 2g
iPhone 3g
iPhone 3gs
iPhone 4
iPad
iPhone 4s
iPad 2
iPad 3









출처 : http://gamedev.stackexchange.com/questions/49963/max-texture-size-android-which-settings-for-2048x2048

반응형

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

유니티 메모리 최적화  (0) 2013.07.03
iOS 디바이스 별 메모리 사용 한계치  (0) 2013.07.02
게임 중 일시정지 하기  (0) 2013.05.30
Random.Range(min, max) 함수의 max값에 대해..  (0) 2013.05.21
유니티 소소한 TIP  (0) 2013.04.05
Posted by blueasa
, |

링크 : http://blog.naver.com/khaetnim/100180096070

반응형

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

iOS 디바이스 별 메모리 사용 한계치  (0) 2013.07.02
Max Texture Size of iOS Devices  (0) 2013.06.14
Random.Range(min, max) 함수의 max값에 대해..  (0) 2013.05.21
유니티 소소한 TIP  (0) 2013.04.05
How to get SceneView Camera?  (0) 2013.03.25
Posted by blueasa
, |