블로그 이미지
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-02 00:00


IntPtr.Size returns 8 when the app is 64 bit and 4 when the app is 32 bit. – Programmer Oct 9 '16 at 5:12


[출처] https://stackoverflow.com/questions/39939785/how-to-know-unity-build-application-is-32bit-or-64bit

반응형
Posted by blueasa
, |
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class Tools : MonoBehaviour {

    //get local ip address
    public string getIP() {

        string IP = "";

        IP = Network.player.ipAddress; <--- this

        return IP;
    }

    //get all ip addresses in local network
    public List<string> getIPArray() {

        List<string> listIP = new List<string>();


        return listIP;
    }
}



[출처]

https://stackoverflow.com/questions/37951902/how-to-get-ip-addresses-of-all-devices-in-local-network-with-unity-unet-in-c


[참조] http://www.devkorea.co.kr/bbs/board.php?bo_table=m03_qna&wr_id=29214

반응형
Posted by blueasa
, |

Unity에서 Xcode 출력 후 필요한 설정을 자동화하는 방법입니다. 
이번에는 잘 사용할 것 같은 것을 샘플 형식으로 정리했습니다.

■ 이용하는 기능 
Unity5에서 표준 이용할 수있게되었다 XcodeAPI을 이용 
Unity - Scripting API : PBXProject

■ 자동화 항목 
빌드 설정 편집 
프레임 워크의 추가 
컴파일 플래그의 설정 
· Info.plist 추가

■ 전 준비 
PostProcessBuildAttribute를 이용하여 빌드 후 메소드를 호출

using System.IO;
 using UnityEngine;
 using UnityEditor;
 using UnityEditor.iOS.Xcode;
 using UnityEditor.Callbacks;
 using System.Collections;

public  class XcodeSettingsPostProcesser
{
    [PostProcessBuildAttribute ( 0 )]
     public  static  void OnPostprocessBuild (BuildTarget buildTarget, string pathToBuiltProject)
    {
        // iOS 이외 플랫폼은 처리를하지 
        if (buildTarget! = BuildTarget.iOS) return ;

        // PBXProject 초기화 
        var projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj" ;
        PBXProject pbxProject = new PBXProject ();
        pbxProject.ReadFromFile (projectPath);
        string targetGuid = pbxProject.TargetGuidByName ( "Unity-iPhone" );
        
        // 여기에 자동화 처리 기술

        // 설정을 반영
        File.WriteAllText (projectPath, pbxProject.WriteToString ());
    }
}

■ 빌드 설정 편집

// 빌드 설정 추가 
pbxProject.AddBuildProperty (targetGuid, "OTHER_LDFLAGS" , "-all_load" );

// 빌드 설정 추가 
pbxProject.SetBuildProperty (targetGuid, "ENABLE_BITCODE" , "NO" );

// 빌드 설정 편집, 제 3 인수는 추가 설정 제 4 인수는 삭제 설정 
pbxProject.UpdateBuildProperty (targetGuid, "OTHER_LDFLAGS" , new  string [] { "-ObjC" }, new  string [] { "- weak_framework " });

■ 프레임 워크 추가

// 필수 프레임 워크의 추가 
pbxProject.AddFrameworkToProject (targetGuid, "Security.framework" , false );

// 옵션 프레임 워크의 추가 
pbxProject.AddFrameworkToProject (targetGuid, "SafariServices.framework" , true );

■ 컴파일 플래그 설정

// Keyboard.mm에 -fno-objc-arc를 설정 
var guid = pbxProject.FindFileGuidByProjectPath ( "Classes / UI / Keyboard.mm" );
var flags = pbxProject.GetCompileFlagsForFile (targetGuid, guid);
flags.Add ( "-fno-objc-arc" );
pbxProject.SetCompileFlagsForFile (targetGuid, guid, flags);

■ Info.plist 추가

// Plist 설정을위한 초기화 

var plistPath = Path.Combine (pathToBuiltProject, "Info.plist" );

var plist = new PlistDocument ();

plist.ReadFromFile (plistPath);



// 문자열의 설정 

plist.root.SetString ( "hogehogeId" , "dummyid" );



// URL 스키마 추가 var array = plist.root.CreateArray ( "CFBundleURLTypes");

var urlDict = array.AddDict ();

urlDict.SetString ( "CFBundleURLName" , "hogehogeName" );

var urlInnerArray = urlDict.CreateArray ( "CFBundleURLSchemes" );

urlInnerArray.AddString ( "hogehogeValue" );



// 설정을 반영

plist.WriteToFile (plistPath);

■ 정리 
Unity5되어 설정이 상당히 쉬워졌습니다

■ 코드 전체

using System.IO ;
using UnityEngine ;
using UnityEditor ;
using UnityEditor.iOS.Xcode ;
using UnityEditor.Callbacks ;
using System.Collections ;
public class XcodeSettingsPostProcesser
{
[PostProcessBuildAttribute ( 0 )
public static void OnPostprocessBuild ( BuildTarget buildTarget , string pathToBuiltProject )
{
// Stop processing if targe is NOT iOS
if (buildTarget! = BuildTarget.iOS)
return ;
// Initialize PbxProject
var projectPath = pathToBuiltProject + " /Unity-iPhone.xcodeproj/project.pbxproj " ;
PBXProject pbxProject = new PBXProject ();
pbxProject.ReadFromFile (projectPath);
string targetGuid = pbxProject.TargetGuidByName ( " Unity-iPhone " );
// Sample of adding build property
pbxProject.AddBuildProperty (targetGuid, " OTHER_LDFLAGS " , " -all_load " );
// Sample of setting build property
pbxProject.SetBuildProperty (targetGuid, " ENABLE_BITCODE " , " NO " );
// Sample of update build property
pbxProject.UpdateBuildProperty (targetGuid, " OTHER_LDFLAGS " , new string [] { " -ObjC " }, new string [] { " -weak_framework " });
// Sample of adding REQUIRED framwrok
pbxProject.AddFrameworkToProject (targetGuid, " Security.framework " , false );
// Sample of adding OPTIONAL framework
pbxProject.AddFrameworkToProject (targetGuid, " SafariServices.framework " , true );
// Sample of setting compile flags
var guid = pbxProject.FindFileGuidByProjectPath ( " Classes / UI / Keyboard.mm " );
var flags = pbxProject.GetCompileFlagsForFile (targetGuid, guid);
flags.Add ( " -fno-objc-arc " );
pbxProject.SetCompileFlagsForFile (targetGuid, guid, flags);
// Apply settings
File.WriteAllText (projectPath, pbxProject.WriteToString ());
// Samlpe of editing Info.plist
var plistPath = Path.Combine (pathToBuiltProject, " Info.plist " );
var plist = new PlistDocument ();
plist.ReadFromFile (plistPath);
// Add string setting
plist.root.SetString ( " hogehogeId " , " dummyid " );
// Add URL Scheme
var array = plist.root.CreateArray ( " CFBundleURLTypes " );
var urlDict = array.AddDict ();
urlDict.SetString ( " CFBundleURLName " , " hogehogeName " );
var urlInnerArray = urlDict.CreateArray ( " CFBundleURLSchemes " );
urlInnerArray.AddString ( " hogehogeValue " );

// Localizations [added blueasa / 2018-03-28] // need Language Code(ref:https://ko.wikipedia.org/wiki/ISO_639) var arrayLocalizations = plist.root.CreateArray("CFBundleLocalizations"); arrayLocalizations.AddString("en"); // 영어 arrayLocalizations.AddString("ko"); // 한국어

//arrayLocalizations.AddString("zh"); // 중국어

arrayLocalizations.AddString("zh_CN"); // 중국어(간체) : 중국 arrayLocalizations.AddString("zh_TW"); // 중국어(번체) : 대만 arrayLocalizations.AddString("ja"); // 일본어 arrayLocalizations.AddString("de"); // 독일어

// Apply editing settings to Info.plist
plist.WriteToFile (plistPath);
}
}

gist.github.com



[출처] http://smartgames.hatenablog.com/entry/2016/06/19/164052

반응형
Posted by blueasa
, |

유니티에서 아이폰X의 하단 Home Indicator 비활성화 하는 방법 찾다가


유니티는 어느 클래스에 넣으란건지 몰라서 헤멨는데 알맞은 답변을 찾아서 펌~


[추가2]

Unity v5.6.5f1 이상에서 Build Settings에 옵션이 추가 됐는데 하단 소스 대응되는 옵션 스크린샷 추가 해놓음.

1. - (BOOL)prefersHomeIndicatorAutoHidden; // add this

-> Off 돼 있어야 함.


2. - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures; // add this

-> 모두 On


[추가]

아래 소스를 적용해보니 Home Indicator가 Hide 되긴 하는데 아무 곳이나 터치(드래그 아님) 하면 Home Indicator가 활성화 되는 문제가 있어서 다른팀에 문의해보니 prefersHomeIndicatorAutoHidden을 YES로 하면 안된다고 한다.

prefersHomeIndicatorAutoHidden을 소스에서 없애라고 함.

없애고 테스트 해보니 원하는대로 동작(비활성화 상태에서 드래그하면 활성화 되면서 1회 드래그 무시)한다.


[설명]

Unity 5.6.4f1

XCode 9.1


XCode Project-Classes-UI 폴더에 가면 UnityViewControllerBaseiOS.h / UnityViewControllerBaseiOS.mm 파일이 있음.

해당 파일에 아래 add this 주석 달린 소스 추가


[참고]

This is for both status and edge protection


UnityViewControllerBaseiOS.h

Code (CSharp):
  1.  
  2. @interface UnityViewControllerBase : UIViewController
  3. {
  4. }
  5.  
  6. - (BOOL)shouldAutorotate;
  7.  
  8. - (BOOL)prefersStatusBarHidden;
  9. - (UIStatusBarStyle)preferredStatusBarStyle;
  10. - (BOOL)prefersHomeIndicatorAutoHidden; // add this
  11. - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures; // add this
  12. @end
  13.  

UnityViewControllerBaseiOS.mm

Code (CSharp):
  1.  
  2. - (BOOL)shouldAutorotate
  3. {
  4.     return YES;
  5. }
  6.  
  7. // add this
  8. - (BOOL)prefersHomeIndicatorAutoHidden
  9. {
  10.     return YES;
  11. }
  12.  
  13. // add this
  14. - (UIRectEdge)preferredScreenEdgesDeferringSystemGestures
  15. {
  16.     return UIRectEdgeAll;
  17. }
  18.  
  19. - (BOOL)prefersStatusBarHidden
  20. {
  21. ....
  22.  



[출처] https://forum.unity.com/threads/option-to-hide-iphone-x-home-indicator-edge-protection.500991/



반응형
Posted by blueasa
, |

UnityEngine.iOS.Device.generation 체크


[참조1] https://docs.unity3d.com/kr/current/ScriptReference/iOS.Device-generation.html

[참조2] https://docs.unity3d.com/kr/current/ScriptReference/iOS.DeviceGeneration.html

반응형
Posted by blueasa
, |

[펌] ERROR ITMS-4238

Unity3D/Tips / 2017. 11. 2. 19:43


ios도 모르고 하이브리드 앱 개발하기 [ 25  ERROR ITMS-4238  ]





Xcode로 앱을 등록하는 과정에서 다음과 같은 오류가 생겼다.

ERROR ITMS-4238: "Redundant Binary Upload. There already exists a binary upload with build version '1' for train '1.0'" at SoftwareAssets/PreReleaseSoftwareAsset



일단 오류가 나면 당황스럽다.


위 에러는 등록하려는 앱을 중복 업로드할 수 없다는 내용이다.


같은 Version 의 Build 값이 같은 앱은 아이튠즈 커넥트에 등록 할 수 없다.



앱을 다시 등록 할 경우에 

Project > General > Identity > Build 를 수정해 주어야 한다. 


당연히 재배포 시에는 Version 까지 수정해 주어야 한다.




출처: http://cofs.tistory.com/248 [CofS]

반응형
Posted by blueasa
, |

iOS 10에서 Privacy 설정

기존 앱을 XCode8로 다시 빌드하면 
iOS 10에서 카메라나 다른 기능을 사용시 아무런 경고도 없이 Crash가 발생하게 된다.

디버그 메시지는 다음과 같다.

This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app’s Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.

iOS 10에서 아래와 같은 기능을 사용하기 위해서는 사용자의 확인 메시지를 설정해줘야 한다.

사용 설명을 요구하는 API 항목들

Data ClassXCode KeyRaw Info.plist Key
Apple MusicPrivacy - Media Library Usage DescriptionNSAppleMusicUsageDescription
BluetoothPrivacy - Bluetooth Peripheral Usage DescriptionNSBluetoothPeripheralUsageDescription
CalendarPrivacy - Calendars Usage DescriptionNSCalendarsUsageDescription
CameraPrivacy - Camera Usage DescriptionNSCameraUsageDescription
ContactsPrivacy - Contacts Usage DescriptionNSContactsUsageDescription
HealthPrivacy - Health Share Usage Description Privacy - Health Update Usage DescriptionNSHealthShareUsageDescription NSHealthUpdateUsageDescription
HomePrivacy - HomeKit Usage DescriptionNSHomeKitUsageDescription
LocationPrivacy - Location Always Usage Description Privacy - Location When In Use Usage DescriptionNSLocationAlwaysUsageDescription NSLocationWhenInUseUsageDescription
MicrophonePrivacy - Microphone Usage DescriptionNSMicrophoneUsageDescription
MotionPrivacy - Motion Usage DescriptionNSMotionUsageDescription
PhotosPrivacy - Photo Library Usage DescriptionNSPhotoLibraryUsageDescription
RemindersPrivacy - Reminders Usage DescriptionNSRemindersUsageDescription
SiriPrivacy - Siri Usage DescriptionNSSiriUsageDescription
Speech RecognitionPrivacy - Speech Recognition Usage DescriptionNSSpeechRecognitionUsageDescription
TV Provider AccountPrivacy - TV Provider Usage DescriptionNSVideoSubscriberAccountUsageDescription

Info.plist에서 Privacy 설정을 추가해주면 된다.


다음은 사진 라이브러리와 카메라 접근시 사용 예제입니다.

Privacy - Camera Usage Description
Privacy - Photo Library Usage Description

[추가] Decription String을 필수로 넣어야 함. - blueasa

[Privacy - Camera Usage Description] Everyplay requires access to the Camera library

[Privacy - Photo Library Usage Description] Everyplay requires access to the photo library

[Privacy - Calenders Library Usage Description] Some ad content may access calendar


앱에서 사진 라이브러리 접근시 다음과 같은 메시지를 보게 된다.



출처: http://kka7.tistory.com/40 [까칠하게 살자]


[참조1] https://dev.tapjoy.com/ko/submitting-ios-results-warning-nscalendarsusagedescription/


[참조2] http://docs.telerik.com/platform/knowledge-base/troubleshooting/troubleshooting-app-rejected-from-app-store-missing-info-plist-key



반응형
Posted by blueasa
, |


[Windows Path] Users\<user>\AppData\LocalLow\Unity\WebPlayer\Cache\<project_name>\


[Mac Path] ~/Library/Caches/Unity/



[출처] http://answers.unity3d.com/questions/956259/where-is-the-cache-folder-for-wwwloadfromcacheordo.html

반응형
Posted by blueasa
, |


[링크] http://blog.naver.com/rapkuma/220150432332



반응형
Posted by blueasa
, |

ARKit(Animoji 관련)

Unity3D/Tips / 2017. 9. 26. 12:01

[Unity ARKit Plugin]

https://www.assetstore.unity3d.com/kr/#!/content/92515



[Animoji]

https://forums.developer.apple.com/thread/86937

https://developer.apple.com/videos/play/fall2017/601/

https://developer.apple.com/documentation/arkit

반응형
Posted by blueasa
, |