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

카테고리

분류 전체보기 (2738)
Unity3D (817)
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-06 11:21

 

[링크] slee16.blog.me/221706003164

 

Tip : Unity 자이로 & 가속도 센서 관련

​기기의 기울기를 사용하는 게임제작 외주를 하고 있는데, 분명 나온지 오래된 기능이고 많이 사용했을 것...

blog.naver.com

 

반응형
Posted by blueasa
, |
    /// <summary>
    /// 회전 없이 유도 이동만 하는 함수
    /// </summary>
    /// <param name="_trTarget">목표 지점</param>
    /// <param name="_v3CurrentDirection">현재 오브젝트가 이동할 방향</param>
    /// <returns></returns>
    IEnumerator Move_Guided(Transform _trTarget, Vector3 _v3CurrentDirection)
    {
        Transform trTarget = _trTarget;
        Vector3 v3TargetDirection = (trTarget.position - this.transform.position).normalized;
        Vector3 v3CurrentDirection = _v3CurrentDirection;
        if (v3CurrentDirection == Vector3.zero)
        {
            v3CurrentDirection = v3TargetDirection;
        }

        float fLookSpeed = 7f;
        float fMoveSpeed = 50f;
        float fAccumTime = 0f;

        while (0.01f < (this.transform.position - trTarget.position).sqrMagnitude)
        {
            // Rotate
            v3TargetDirection = (trTarget.position - this.transform.position).normalized;
            v3CurrentDirection = Vector3.RotateTowards(v3CurrentDirection, v3TargetDirection, Time.deltaTime * fLookSpeed, 0f);
            v3CurrentDirection = v3CurrentDirection.normalized;
            // Translate
            fAccumTime += Time.deltaTime * fMoveSpeed;
            this.transform.localPosition += (v3CurrentDirection * fAccumTime);
            yield return null;
        }

        yield return null;
        
        // 도착했으면 Destroy or Recycle
    }

 

보통 유도 기능 만들때 오브젝트 자체를 회전시키고, transform.forward 방향으로 Translate만 하면 됐는데

 

이번에는 유도 기능으로 이동만 하고 회전하지 않게 하기 위해서

Direction Vector를 따로 두고 Vector3.RotateTowards()를 사용해서 이동하게 만들었다.

 

P.s. 적당히 테스트 한거니 더 이쁘게 만들고 싶은분은 직접 수정 및 테스트 해보세요.

 

[참조] https://docs.unity3d.com/ScriptReference/Vector3.RotateTowards.html

반응형
Posted by blueasa
, |

IOException: Sharing violation on path ..\Temp\StagingArea\assets\bin\Data\Managed\tempStrip\Firebase.Analytics.dll

 

빌드하다가 못보던 dll 관련 빌드 에러가 나서 확인해보니 백신 관련 문제였다.

백신에서 해당 프로젝트 폴더를 예외처리 하던지, 백신을 잠시 끄자.

 

 

[참조]

Answer by timkeosa · '17년 Jul월 25일 PM 06시 04분

I encountered a very similar issue and found it was caused by the antivirus software. By suspending the antivirus process, I was able to work around the problem.

Try configuring your AV to "exclude" your project directory, but if that fails then you'll need to either disable or temporarily suspend the AV's process.

 

 

[출처] https://answers.unity.com/questions/1381688/ioexception-sharing-violation-on-path-after-build.html

 

IOexception: Sharing violation on path after build - Unity Answers

 

answers.unity.com

 

반응형
Posted by blueasa
, |

[Error Message]

This release is not compliant with the Google Play 64-bit requirement

The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: 93.

Include 64-bit and 32-bit native code in your app. Use the Android App Bundle publishing format to automatically ensure that each device architecture receives only the native code it needs. This avoids increasing the overall size of your app.

https://developer.android.com/distribute/best-practices/develop/64-bit

 

[Answer]

For those who have this problem since yesterday (August 19, 2019):

In Player Settings > Other Settings you must now uncheck the x86 box (It is for the 32-bit Intel architecture).


You will now only have the following warning:

The device types on which your application can be installed will be more restricted.

But, in my case, it drops from 12392 devices to 12385 devices.

Here is the opinion of a Unity member on the issue:

x86 is used by less than 0.4% of all Android devices, so it shouldn't have any real impact.

x86 target will be removed completely in Unity 2019.3.

 

[출처]

https://stackoverflow.com/questions/57332053/unity-aab-not-compliant-with-the-google-play-64-bit-requirement

 

Unity aab not compliant with the Google Play 64-bit requirement

I have a Unity project that I'm switching from APKs to AABs (app bundles). Previously, when I was building it as an APK, the Google Play Console told me the APK was 64-bit compliant. Now that I'm

stackoverflow.com

 

반응형
Posted by blueasa
, |

Unity Editor-Edit-Preferences-General에 보면 Script Changes While Playing 옵션이 있다.

 

기본이 위 스크린샷 처럼 'Recompile And Continue Playing'이라서, 플레이 중에 소스 수정하면 리컴파일 되고 에러가 열심히 난다

 

플레이 중엔 리컴파일 안되도록 막기 위해서 2번째인 'Recompile After Finished Playing'로 바꿨다.

 

 

[출처] 게임코디-핑크님

반응형
Posted by blueasa
, |

플랫폼 대응을 위해 유니티 버전을 2018.3.5f1에서 2018.4.2f1로 버전업을 하였는데 그 뒤로 비주얼스튜디오를 유니티에 붙이면 멈춤 현상이 일어났다. 당연히 브레이크 포인트에 걸리지 않은 상태였고 Attach를 해제하면 정상작동을 하였다.

원인은 유니티의 오래된 버그라고한다.

해결방법은 비주얼스튜디오에 남아있는 모든 중단점을 삭제한 후 다시 Attach하게되면 정상작동하게된다. 이 후 브레이크포인트를 걸고 작업 후 다시 Attach를 해도 문제없이 작동한다.

출처 : https://forum.unity.com/threads/unity-freeze-when-connecting-vs-debugger.529863/

 

 

[출처] https://puzi.tistory.com/19

 

[비주얼 스튜디오] 디버그를 위해 Unity에 Attach할 시 Freeze현상

플랫폼 대응을 위해 유니티 버전을 2018.3.5f1에서 2018.4.2f1로 버전업을 하였는데 그 뒤로 비주얼스튜디오를 유니티에 붙이면 멈춤 현상이 일어났다. 당연히 브레이크 포인트에 걸리지 않은 상태였고 Attach를..

puzi.tistory.com

 

반응형
Posted by blueasa
, |

Google play console에 처음 apk를 등록하는 분들이라면 한번씩 겪게되는 상황이 있습니다. 바로 keystore 생성을 하지않아 apk 업로드 실패하는 상황이죠....

 

유니티 개발자들은 별 어려움 없이 몇가지 작업으로 keystore를 생성할 수 있습니다.

 

1. File -> BuildSettings -> PlayerSetting ->Publishing setting 으로 이동하면 다음과 같은 화면을 볼 수 있습니다.

 

 

 

우리는 새 키스토어를 생성하려는 것이기 때문에

2. Create a new keystore를 눌러줍니다.

 

3. Keystore password

비밀번호를 입력하고 밑에같에 확인란 까지 같이 입력해줍니다.

 

4. Browse Keystore를 눌러줍니다. 

 

네... 몇몇분들도 저랑 같은 생각을 하시지 않을까합니다. 새로 생성한는데 '왜 키스토어파일을 찾냐..?'

 

직접해본결과 create a new keystore를 체크한 상태에서는 파일을 찾는게아니라.. 새로생성될 keystore 파일의 저장 경로와 저장될 파일명을 세팅하는 것이었습니다. 

(헤깔리게 하지마 ㅜㅜㅜㅜㅜ)

 

 

 

5.Key Alias 생성

위에서 keystore 비밀번호 입력 까지 정삭적으로 끝냈다면 Alias를 새로 생성할 수 있습니다.
Unsignes를 눌러 Create new key를 눌러줍니다.

 

6. 정보 입력

 

Alias - 아무 이름 지어서 적어 넣습니다.

password - 비밀번호 안까먹을 만한걸로 적어줍니다.

confirm - 비밀번호 재확인

validity( years) - 50년은 충분한 시간이라고 생각됩니다. 그냥 내비둡니다.

 

나머지 밑에는 건너뛰고 
 country code 만 Ko로 적고  create Key를 눌러 생성을 하였습니다.

 

이제 새로생성한 keystore와 key를 세팅해주고 비밀번호를 정상적으로 입력해줍니다.

 

7. apk 생성

네 이제 끝까지 왔습니다. 

 

 

8. apk 업로드 

 

위의 과정을 잘 따라 하셨다면 정상적으로 업로드된 화면을 볼 수 있으셨을 것 입니다. 



출처: https://enjoylifeforme.tistory.com/entry/Unity-Keystore-생성 [즐거운하룽]

 

[Unity] Keystore 생성

[Unity] Keystore 생성 Google play console에 처음 apk를 등록하는 분들이라면 한번씩 겪게되는 상황이 있습니다. 바로 keystore 생성을 하지않아 apk 업로드 실패하는 상황이죠.... 유니티 개발자들은 별 어려움..

enjoylifeforme.tistory.com

 

 

반응형
Posted by blueasa
, |

OS : Windows7 64bit

Unity : 2018.4.13f1

Firebase : 6.9.0


Generation of the Firebase Android resource file google-services.xml from Assets/Firebase/google-services.json failed.
If you have not included a valid Firebase Android resources in your app it will fail to initialize.
"C:\Project\git\ProjectName\Assets\Firebase\Editor\generate_xml_from_google_services_json.exe" -i "Assets/Firebase/google-services.json" -l

Traceback (most recent call last):
  File "", line 446, in 
  File "", line 289, in main
  File "", line 228, in argv_as_unicode_win32
AttributeError: 'module' object has no attribute 'wintypes'
generate_xml_from_google_services_json returned -1


Firebase 6.9.0을 유니티에 Import하고 위와 같은 에러를 보게 됐다.

결론적으로 wintypes attribute가 없다는 말인데 저게 뭔지 몰라서 한참 찾아 헤메다가

아래 링크에서 답을 찾았다.

 

[해결방법] 원본 (https://github.com/firebase/quickstart-unity/issues/540)

[해결방법] Detail (https://github.com/firebase/quickstart-unity/issues/540)

 

결론적으로 Firebase 6.9.0이 Windows7을 제대로 지원하지 않는 것 같다.

그래서 generate_xml_from_google_services_json.exe 파일을 다시 컴파일하는 작업을 위해서 설명하고 있다.

Python 2.7이 필요한데, Python 2.7.9 이상을 설치해야 pip가 Python에 기본적으로 들어 있다.

나는 아래 링크의 2.7.17을 깔았다.

 

[Python 2.7.17 다운로드] https://www.python.org/downloads/release/python-2717/

 

해결방법 Detail 설명대로 다하고나니 이제 에러가 뜨지 않는다.

 

 

P.s. Windows7 지원 종료가 되면서 여기저기 다른 곳에서도 지원을 종료하면서 개발에 피해가 오고 있는 걸 체감하고 있다.

    현재 피해 당하고 있는 건 SourceTree와 Firebase..-_-

 

 
반응형
Posted by blueasa
, |

[수정] 2021-06-10

Height 값 참조 오류 수정(참조 값 manualHeight -> activeHeight로 변경)

 

[스크립트 파일]

UISafeAreaOffsetController.cs
0.00MB

 

아래 위치와 같이 Anchor의 하위에 GameObject를 하나 만들고,

인스펙터와 같이 Top/Bottom에 따라 만들어진 GameObeject를 Drag&Drop 해서 Link 한다.

 

 

위와 같이 셋팅해 주면 Fan이 Top쪽 Safe Area가 있으면 그에 맞게 좀 더 내려온다

(Bottom은 같은 형태로 List Offset List_Bottom에 Link 해주면 된다.)

 

대충 만들어서 넣어놔서 정리좀 하고 싶지만 다음 기회로..

필요하신 분은 받아서 써보시고 개량해서 공유 좀 해주세요~

 

 

[참조] https://blueasa.tistory.com/2272

반응형
Posted by blueasa
, |

우선, NGUI의 UIAnchor 대해 SafeAreas 대응 할 수 있기 때문에 참고.

이외에도 SafeAreas으로 다음의 대응이 필요하지만,이 기사에서는 UIAnchor의 대처 방법을 설명합니다.

필요할 수 :

· UIRect의 Anchor

· UIScrollView의 표시 범위 조정 (Anchor의 기준이 변화하기 때문에 UI 조정해야 할)




Contents [ hide ]

전제 조건 :

이 문서는 다음을 전제로 이야기를 진행합니다.

· Unity5.6.6를 사용하여 개발하고 있습니다.

· iOSSafeAreasPlugin을 다운로드하여 가져올 수 있음

Plugin 다운로드 사이트

https://bitbucket.org/p12tic/iossafeareasplugin/src

· OS는 iOS만을 고려하고 있습니다.

소스 코드

우선 소스 코드에서 공개합니다.

안전 영역의 취득

SafeAreaScreen.cs

이 소스 코드는 주로 안전 영역의 취득을 담당하고 있습니다.

Unity 편집기에서 화면 크기를 iPhoneX와 같은 크기 (1125 × 2436)로 설정하면 Unity Player에서 디버그 할 수도 있습니다.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Runtime.InteropServices;

public class SafeAreaScreen  {

#if UNITY_IOS
    [DllImport("__Internal")]
    private extern static void GetSafeAreaImpl(out float x, out float y, out float w, out float h);
#endif

    static public Rect GetSafeArea()
    {
        float x, y, w, h;

        //初期値設定
        x = 0;
        y = 0;
        w = Screen.width;
        h = Screen.height;

#if UNITY_IOS && !UNITY_EDITOR
        //iOSSafeAreasPluginを呼び出す
        GetSafeAreaImpl(out x, out y, out w, out h);

#elif UNITY_ANDROID && !UNITY_EDITOR
        //Androidの縦長端末対応が必要になったときのために

#else


        //UnityエディタでiPhoneXのテストできるように値を設定する
        if(Screen.width == 1125 && Screen.height == 2436 ){
            y = 102;
            h = 2202;
        }

#endif
        return new Rect(x, y, w, h);
    }

    static public int GetTopOffsetY(){
        int offset = 0;

        //画面の高さとセーフエリアの高さの差分
        Rect screenSize = GetSafeArea();

        if (Screen.height != screenSize.height) {
            offset = Screen.height - (int)screenSize.height - (int)screenSize.y;
        }

        return offset;
    }

    static public int GetBottomOffsetY(){
        int offset = 0;

        //セーフエリアのyの位置取得
        Rect screenSize = GetSafeArea();

        if (Screen.height != screenSize.height) {
            offset = (int)screenSize.y;
        }

        return offset;
    }

}

NGUI의 SafeArea

NguiSafeAreaPatch.cs

SafeAreaScreen.cs에서 얻은 안전 영역을 바탕으로 Anchor의 위치를 ​​조정합니다.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NguiSafeAreaPatch : MonoBehaviour {

    void Awake()
    {
        // UIAnchorを使ってAnchorを設定している場合
        UIAnchor anchor = gameObject.GetComponent();
        if(anchor != null){

            //offsetの値を取得する
            SetUIAnchorOffset(anchor);

            return;
        }

        // UIRectをAnchorを使っている場合
        UIRect rect = gameObject.GetComponent();
        if (rect != null) {
            //現在,NGUIのソースコードを解析中
            //完成しだい公開予定
            return;
        }
    }

    private void SetUIAnchorOffset(UIAnchor anchor){

        //現在のoffsetを取得する
        Vector2 nowOffset = anchor.pixelOffset;

        //TOP側の補正値取得
        int topCorrectionOffset = SafeAreaScreen.GetTopOffsetY ();

        //Bottom側の補正値取得
        int bottomCorrectionOffset = SafeAreaScreen.GetBottomOffsetY ();

        switch (anchor.side) {

            case UIAnchor.Side.Top:
            case UIAnchor.Side.TopLeft:
            case UIAnchor.Side.TopRight:
                anchor.pixelOffset.Set(nowOffset.x, nowOffset.y - topCorrectionOffset);

            break;

            case UIAnchor.Side.Bottom:
            case UIAnchor.Side.BottomLeft:
            case UIAnchor.Side.BottomRight:
                anchor.pixelOffset.Set(nowOffset.x, nowOffset.y + bottomCorrectionOffset);			
            break;


        }
        
    }



}

 

사용법은이 소스 코드를 UIAnchor가 부착되어있는 게임 객체에 첨부 할뿐.

소스에서 무슨 일을하는지는 동작 환경이 iPhoneX 판정되면 스크린과 안전 영역의 높이의 차이를 계산하여 차등 분 게임 오브젝트를 낮 춥니 다.

델타 값은 UIAnchor의 "Pixel Offset"에 할당됩니다.

소스 코드를 반영한 ​​결과

NguiSafeAreaPatch.cs을 UIAnchor에 연결시킨 결과를 기재합니다.

■ 반영 전

■ 반영 후

그 결과 안전 영역을 기준으로 할 수있었습니다.

이것으로 UIAnchor 대해서는 SafeArea의 대처가되었습니다.

그러나, 그 밖에도 「UIRect의 Anchor '에 대해서도 SafeAreas 대응이 있습니다. 대응이 끝나는대로 수시 문서에 추가하는 것입니다.

 

 

[출처] https://dream-target.jp/2018/10/01/post-470/

 

UnityにてiPhoneX対応・NGUIのUIAnchorにSafeAreaの補正処理を入れてみた

とりあえず、NGUIのUIAnchorについてSafeAreas対応ができたのでメモ。 実行環境がiPhoneXと判定したら、スクリーンとセーフエリアの高さの差分を計算して、差分だけゲームオブジェクト(UIAnchorがアタッチされていること)を下げます。

dream-target.jp

 

반응형
Posted by blueasa
, |