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

카테고리

분류 전체보기 (2797)
Unity3D (853)
Script (91)
Extensions (16)
Effect (3)
NGUI (81)
UGUI (9)
Physics (2)
Shader (37)
Math (1)
Design Pattern (2)
Xml (1)
Tips (201)
Link (23)
World (1)
AssetBundle (25)
Mecanim (2)
Plugins (79)
Trouble Shooting (70)
Encrypt (7)
LightMap (4)
Shadow (4)
Editor (12)
Crash Report (3)
Utility (9)
UnityVS (2)
Facebook SDK (2)
iTween (3)
Font (13)
Ad (14)
Photon (2)
IAP (1)
Google (8)
Android (51)
iOS (44)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (185)
협업 (61)
3DS Max (3)
Game (12)
Utility (68)
Etc (98)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (55)
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

Here are two small tricks that can help if you’re making an isometric 2D game in Unity. Ok, so not actually isometric, but that’s the term we’re used to in videogames, so we’ll go with it. These are quite basic and if you’re working on such a game you’ve probably already tackled them your own way. This is our take on it, hopefully it’s useful to someone.

Sprite Ordering

Normally in a 2D game there is no concept of depth, so if you simply place the sprites in the world, you’ll most likely have objects appearing in the wrong order than what you’d expect in an isometric game.

 

Thankfully Unity exposes Sorting Layer and Order In Layer properties for Renderers.
A quick fix is to set the value of Order in Layer to depend on the Y position of the object.

 

[ExecuteInEditMode]
[RequireComponent(typeof(Renderer))]
public class DepthSortByY : MonoBehaviour
{

    private const int IsometricRangePerYUnit = 100;

    void Update()
    {
        Renderer renderer = GetComponent();
        renderer.sortingOrder = -(int)(transform.position.y * IsometricRangePerYUnit);
    }
}

This solves the problem for the simplest case, when we assume all objects rest on the ground.

 

Let’s assume we want to have an object that is above the ground in the world, like placing a bird house on that tree. Just trying to place it in the world will treat the pivot of the object as being at ground level, with no way to both place it at a proper height and sort it correctly.

 

There are several options for this. Just to get it out of the system, the first option is to add empty space to the texture below the bird house to make sure the pivot is at ground level (in Unity, the pivot can’t be outside of the sprite). This is baaaad! This is wasting texture space, and all instances of that object will need to be at the same height in the game. There are other, less insane, options.

One is having a height property in the DepthSortByY behavior and subtract it from transform.position.y when computing the sorting order.
Another solution (which we went with) is allowing the DepthSortByY behavior to make the depth computation based on another object’s transform. This way, the objects will be considered to be at the same point in space as their target and they’ll have the same depth order, even if they’re at different Y positions in the scene. In the bird house example, the bird house uses the tree’s world position for its depth computations.
This solution works better for our game, because it allows artists to move the item freely while staying at the depth (and not have to deal with editing the “height” parameter). And mainly because all the gameplay takes place in the ground’s 2D plane anyway so all objects are guaranteed to have a root object that has the ground position. In your own game, it might be easier to just use the first option.

[ExecuteInEditMode]
[RequireComponent(typeof(Renderer))]
public class IsometricObject : MonoBehaviour
{
   private const int IsometricRangePerYUnit = 100;
   
   [Tooltip("Will use this object to compute z-order")]
    public Transform Target;
    
    [Tooltip("Use this to offset the object slightly in front or behind the Target object")]
    public int TargetOffset = 0;
    
    void Update()
    {
        if (Target == null)
            Target = transform;
        Renderer renderer = GetComponent();
        renderer.sortingOrder = -(int)(Target.position.y * IsometricRangePerYUnit) + TargetOffset;
    }
}

This is how this example is set up in Unity:

The birdhouse references the tree for its depth.

 

And this is how it behaves in practice:

 

Ground Projection

For certain visual elements and effect, we wanted them to look properly projected on the ground, but also not spend too much time on making art for them. The ‘isometric’ view of the game means that anything that is horizontally on the ground should look squashed vertically.
For simple sprites, this is quite easy. Just draw them directly with the correct perspective and place them in the game.

Things get more complicated when you need something that should be able to rotate in any direction. Like something to show the direction the character is moving in, or some visual effect sweeping the ground towards your attacking direction. Especially if these are things that are animated, drawing them manually for all possible orientations is out of the question (or so the artists claim).

Our solution is: the artists draw and animate these effects as if viewed top-down, and the programmers take care of transforming them at runtime to look as if they were projected on the ground. Without any transformation, just taken from the artists and placed in the game rotating them to match the player’s direction they look like below.

 

We need to squash them vertically. For a sprite that doesn’t rotate, just scaling on the Y dimension does the job. But for a rotating sprite this doesn’t work, and it’s even worse for animations. The first thing we tried was a custom shader that transformed the vertices in the local space to squash them vertically (naturally, we went with the most complex solution first), but this needed to break batching to work properly with all sprites and animations. Or I was just bad at writing that shader, maybe…

The final solution is absurdly simple. Just rotate the object around the X axis, and it works!
However, we also wanted to:

  • apply the rotation automatically and consistently, and not have to remember or care about setting the X component of the rotation ourselves
  • be able to set the Z component of the rotation (to make the effect rotate towards any game world direction)
  • not have to visit all ‘ground projected’ effects when changing the amount of squashing

Basically, the game should not have to know that a rotation on X axis is happening. If an object has the ProjectOnGround behavior attached, it should just draw properly without additional effort. So we do the math just before rendering, and restore the rotation to its normal value right after. This hides the rotation around the X axis from the rest of the code.

[ExecuteInEditMode]
    public class ProjectOnGround : MonoBehaviour
    {
        private Quaternion savedRotation;

        // called before rendering the object        
        void OnWillRenderObject()
        {
            savedRotation = transform.rotation;
            var eulers = transform.rotation.eulerAngles;
            transform.rotation = Quaternion.Euler(Constants.Isometric.PerspectiveAngle, eulers.y, eulers.z);
        }

        //called right after rendering the object
        void OnRenderObject()
        {
            transform.rotation = savedRotation;
        }
    }

Simple and easy. Too bad I wasted time trying to write a shader for this. The result looks good and we can simple ‘project’ any object by just adding this behavior to it.

 

 

 

[출처] https://breadcrumbsinteractive.com/two-unity-tricks-isometric-games/

 

Two Unity tricks for isometric games - Breadcrumbs

Here are two small tricks that can help if you’re making an isometric 2D game in Unity. Ok, so not actually isometric, but that’s the term we’re used to in videogames, so we’ll go with it. These are quite basic and if you’re working on such a gam

breadcrumbsinteractive.com

 

반응형
Posted by blueasa
, |

Hidden Assets

During the import process, Unity ignores the following files and folders in the Assets folder (or a sub-folder within it):

  • Hidden folders.
  • Files and folders which start with ‘.’.
  • Files and folders which end with ‘~’.
  • Files and folders named cvs.
  • Files with the extension .tmp.

This prevents importing special and temporary files created by the operating system or other applications.

 

[출처] https://forum.unity.com/threads/exclude-files-or-folders-from-importing.48090/

 

Exclude files or folders from importing

Is there any way to exclude psd, jpg, max file (or whole folder) in Assets folder from being imported to Unity as texture or model? I keep my...

forum.unity.com

 

[참조] https://docs.unity3d.com/Manual/SpecialFolders.html?_gl=1*f8onwh*_ga*MTUzMjkzMTA0MC4xNjIyNzEzNDM4*_ga_1S78EFL1W5*MTYyNDg3MTc4MS41LjEuMTYyNDg3MjE4OC4xMA..&_ga=2.190280226.821848530.1624841162-1532931040.1622713438 

 

Unity - Manual: Special folder names

Reusing assets between projects How do you use documentation throughout your workflow? Share your experience with us by taking this survey. Special folder names You can usually choose any name you like for the folders you create to organise your Unity proj

docs.unity3d.com

 

반응형
Posted by blueasa
, |

[Android 앱 이름 로컬라이징] chameleonstudio.tistory.com/51

 

유니티 구글 앱 이름 변경 / 현지화

해당 티스토리 페이지는 필자가 유니티 C# 개발을 하면서 학습한 내용들을 기록하고 공유하는 페이지입니다 ! - 틀린 부분이 있거나, 수정된 부분이 있다면 댓글로 알려주세요 ! - 해당 내용을 공

chameleonstudio.tistory.com

 

 

[iOS 앱 이름 로컬라이징] chameleonstudio.tistory.com/52

 

iOS 앱 이름 변경 / 현지화

해당 티스토리 페이지는 필자가 유니티 C# 개발을 하면서 학습한 내용들을 기록하고 공유하는 페이지입니다 ! - 틀린 부분이 있거나, 수정된 부분이 있다면 댓글로 알려주세요 ! - 해당 내용을 공

chameleonstudio.tistory.com

 

반응형
Posted by blueasa
, |

화면 색상이 이상한 경우 참고하실만한 내용인거 같습니다.

 

겔럭시 S10이상의 폰에서 게임 화면이 하얗게 나오는 현상이 발생합니다.

이 경우 원인은 옵션에서 사용자가 고르는 화면 모드가 원인입니다.

 

옵션 -> 디스플레이 -> 화면 모드를 선택합니다.

 

여기에서 선명한 화면을 선택 해봅시다.

 

정상적으로 색상이 돌아온것을 확인할 수 있습니다.

 

 

[출처]

gamecodi.com/4145/%EA%B2%94%EB%9F%AD%EC%8B%9C-s10%EC%9D%B4%EC%83%81%EC%9D%98-%ED%8F%B0%EC%97%90%EC%84%9C-%EA%B2%8C%EC%9E%84%ED%99%94%EB%A9%B4%EC%9D%B4-%ED%95%98%EC%96%97%EA%B2%8C-%EB%82%98%EC%98%A4%EB%8A%94-%ED%98%84%EC%83%81

 

겔럭시 S10이상의 폰에서 게임화면이 하얗게 나오는 현상 - 게임코디

화면 색상이 이상한 경우 참고하실만한 내용인거 같습니다. 겔럭시 S10이상의 폰에서 게임 화면이 하얗게 나오는 현상이 발생합니다. 이 경우 원인은 옵션에서 사용자가 고르는 화면 모드가 원

gamecodi.com

 

반응형
Posted by blueasa
, |

UnityでiOSとAndrodのランタイムパーミッションの確認と要求を行う方法

 

Unityでアプリのカメラ権限の確認&要求ってどうやるの?

これまでのUnityでのアプリ開発では、iOS/Android端末の機能の権限のチェックやリクエストをするために、ネイティブプラグインを利用する必要がありました。
最近になってやっと、ランタイムパーミッション関係のAPIが追加されたようなので、自分なりに使い方を調べてみました。


[iOS] Application.RequestUserAuthorizationクラス

https://docs.unity3d.com/ja/2018.2/ScriptReference/Application.RequestUserAuthorization.html
Unity2018.1以降で利用可能
iOSでウェブカメラまたはマイクを使用するための承認をリクエストします。
(カメラとマイクの権限のみチェックとリクエストが可能)

[Android] Android.Permissionクラス

https://docs.unity3d.com/2018.3/Documentation/ScriptReference/Android.Permission.RequestUserPermission.html
https://docs.unity3d.com/ja/current/Manual/android-RequestingPermissions.html
Unity2018.3以降で利用可能
Androidでユーザーに、デバイスリソースまたは承認が必要な情報へのアクセスを許可するよう要求します。
(クラスで定義されていない権限でも文字列で指定してチェックとリクエストが可能)


それぞれのプラットフォームに対応している新しく追加されたAPIを使用することで、簡易的な処理ならばネイティブプラグインを使用しないで目的を達成できそうです。
今回はカメラとマイクの権限の確認と要求をセットで行う例の作成を試みました。
そして、何回も試行錯誤した結果、導きだしたコードがこちら。

ランタイムパーミッション要求の例

using UnityEngine;
using System.Collections;
using System;

#if UNITY_ANDROID && UNITY_2018_3_OR_NEWER
using UnityEngine.Android;
#endif

namespace PermissionAuthorizationTest
{
    // iOS/Androidプラットフォームで動作するランタイムパーミッション要求のサンプル
    // 参考URL: https://forum.unity.com/threads/requestuserauthorization-as-a-coroutine-bugged.380666/
    public class PermissionAuthorizationExample : MonoBehaviour
    {
        IEnumerator Start ()
        {
            #if UNITY_IOS && UNITY_2018_1_OR_NEWER

            // iOS
            //
            // カメラパーミッションが許可されているか調べる
            if (!Application.HasUserAuthorization (UserAuthorization.WebCam)) {
                // 権限が無いので、カメラパーミッションのリクエストをする
                yield return RequestUserAuthorization (UserAuthorization.WebCam);
            }
            // マイクパーミッションが許可されているか調べる
            if (!Application.HasUserAuthorization (UserAuthorization.Microphone)) {
                // 権限が無いので、マイクパーミッションのリクエストをする
                yield return RequestUserAuthorization (UserAuthorization.Microphone);
            }
            // リクエストの結果、アプリ機能に必要なパーミッションが全て許可されたか調べる
            if (Application.HasUserAuthorization (UserAuthorization.WebCam) && Application.HasUserAuthorization (UserAuthorization.Microphone)) {
                // 権限が許可されたので、権限が必要なAPIを使用する処理へ進む(iOSでは権限拒否された状態でAPIを使用しようとするとアプリが落ちる)
                findWebCams ();
                findMicrophones ();
            } else {
                // 権限が許可されなかったので、ユーザーに対して権限の使用用途の説明を表示して自分でOSのアプリ設定画面で権限許可を行うようにアナウンスする必要がある。
                // (iOSでは初回の権限リクエストが拒否された場合は、次回からはリクエスト自体が表示されなくなる)
            }       

            #elif UNITY_ANDROID && UNITY_2018_3_OR_NEWER

            // Android
            //
            // カメラパーミッションが許可されているか調べる
            if (!Permission.HasUserAuthorizedPermission (Permission.Camera)) {
                // 権限が無いので、カメラパーミッションのリクエストをする
                yield return RequestUserPermission (Permission.Camera);
            }
            // マイクパーミッションが許可されているか調べる
            if (!Permission.HasUserAuthorizedPermission (Permission.Microphone)) {
                // 権限が無いので、マイクパーミッションのリクエストをする
                yield return RequestUserPermission (Permission.Microphone);
            }
            // リクエストの結果、アプリ機能に必要なパーミッションが全て許可されたか調べる
            if (Permission.HasUserAuthorizedPermission (Permission.Camera) && Permission.HasUserAuthorizedPermission (Permission.Microphone)) {
                // 権限が許可されたので、権限が必要なAPIを使用する処理へ進む
                findWebCams ();
                findMicrophones ();
            } else {
                // 権限が許可されなかったので、ユーザーに対して権限の使用用途の説明を表示してから再度のリクエストを行う。
                // もしも拒否時に「今後表示しない」がチェックされた場合は、次回からリクエスト自体が表示されなくなる、
                // そのためユーザーには自分でOSのアプリ設定画面で権限許可を行うようにアナウンスする必要がある。
                // (Permissionクラスにはそれらの違いを調べる方法は用意されていない)
            }

            #endif

            yield break;
        }

#if (UNITY_IOS && UNITY_2018_1_OR_NEWER) || (UNITY_ANDROID && UNITY_2018_3_OR_NEWER)
        bool isRequesting;

        // OSの権限要求ダイアログを閉じたあとに、アプリフォーカスが復帰するのを待ってから権限の有無を確認する必要がある
        IEnumerator OnApplicationFocus(bool hasFocus)
        {
            // iOSプラットフォームでは1フレーム待つ処理がないと意図通りに動かない。
            yield return null;

            if (isRequesting && hasFocus)
            {
                isRequesting = false;
            }
        }

        #if UNITY_IOS
        IEnumerator RequestUserAuthorization(UserAuthorization mode)
        {
            isRequesting = true;
            yield return Application.RequestUserAuthorization(mode);
            // iOSではすでに権限拒否状態だとダイアログが表示されず、フォーカスイベントが発生しない。
            // その状態を判別する方法が見つからないので、タイムアウト処理をする。

            // アプリフォーカスが戻るまで待機する
            float timeElapsed = 0;
            while (isRequesting)
            {
                if (timeElapsed > 0.5f){
                    isRequesting = false;
                    yield break;
                }
                timeElapsed += Time.deltaTime;

                yield return null;
            }
            yield break;
        }
        #elif UNITY_ANDROID
        IEnumerator RequestUserPermission(string permission)
        {
            isRequesting = true;
            Permission.RequestUserPermission(permission);
            // Androidでは「今後表示しない」をチェックされた状態だとダイアログは表示されないが、フォーカスイベントは通常通り発生する模様。
            // したがってタイムアウト処理は本来必要ないが、万が一の保険のために一応やっとく。

            // アプリフォーカスが戻るまで待機する
            float timeElapsed = 0;
            while (isRequesting)
            {
                if (timeElapsed > 0.5f){
                    isRequesting = false;
                    yield break;
                }
                timeElapsed += Time.deltaTime;

                yield return null;
            }
            yield break;
        }
        #endif
#endif

        void findWebCams ()
        {
            foreach (var device in WebCamTexture.devices) {
                Debug.Log ("Name: " + device.name);
            }
        }

        void findMicrophones ()
        {
            foreach (var device in Microphone.devices) {
                Debug.Log ("Name: " + device);
            }
        }
    }
}

 

読みにくくてすみません、コードの意図は必要以上に詳細なコメントを読んで理解してください。
iOS/Android実機でコードを試した結果、とりあえず期待通りに動作していることを確認しました。

OnApplicationFocus()を使用してアプリフォーカスの復帰を待機する処理は、
RequestUserAuthorization as a coroutine - bugged?
のスレッドのやりとりをヒントにしています。
このためコードがかなり複雑化してしまいました。

とにかく、権限が必要なAPIを利用する前に、あらかじめこのような処理を挟んでおくこで、アプリがクラッシュするなどの事態を避けることが出来るようになりました。

APIが追加される前の古いUnityバージョンではどうする?

Androidでは以下の記事の方法で可能です。ネイティブプラグインが必要無いので気軽に導入できる方法です。
UnityでAndroidのランタイムパーミッションに対応する
iOSでもAndroidでもAssetプラグインを使えば同様の事が実現可能です。たぶん無料のものも存在するはず。

最新のUnityのAPIでも権限の処理には不十分な点も

UnityのAPIは必要最小限の簡易的なものしか用意されていません。
ネイティブアプリと同等の権限の処理をしたい場合は、やはりネイティブプラグインの利用を検討する必要があるでしょう。

参考リンク

UnityにおけるAndroidアプリのパーミッション付与について

 

 

[출처] qiita.com/utibenkei/items/65b56c13f43ce5809561

 

UnityでiOSとAndrodのランタイムパーミッションの確認と要求を行う方法 - Qiita

Unityでアプリのカメラ権限の確認&要求ってどうやるの? これまでのUnityでのアプリ開発では、iOS/Android端末の機能の権限のチェックやリクエストをするために、ネイティブプラグインを利用

qiita.com

 

반응형
Posted by blueasa
, |

Unity2018에서 Unity2019로 올려보면서 나오는 에러 정리

 

그렇게 큰 이슈는 없는 듯 하고, GUIText와 GUITexture가 obsolete 되면서 나온 이슈 뿐인 것 같다.

 

[Error:1] error CS0619: 'GUIText' is obsolete: 'GUIText has been removed. Use UI.Text instead.'

  -> GUIText -> UnityEngine.UI.Text 로 변경

 

[Error:2-1] error CS0619: 'GUITexture' is obsolete: 'GUITexture has been removed. Use UI.Image instead.'

  -> GUITexture -> UnityEngine.UI.Image 로 변경

 

[Error:2-2] error CS1061: 'Image' does not contain a definition for 'texture' and no accessible extension method 'texture' accepting a first argument of type 'Image' could be found (are you missing a using directive or an assembly reference?)

  -> Texture2D를 Sprite로 변환해서 처리

 

public void CameraFadeAdd(Texture2D texture)
{
  ....
  //Create Sprite from the Texture2D
  Sprite tempSprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f);
  cameraFade.GetComponent().sprite = tempSprite;
  ....
}

[Error:2-2 참조] stackoverflow.com/questions/53491613/guitexture-is-deprecated-so-what-should-i-use-instead-of-it

 

[Error:3] 

[해당 씬에 접근 했을 때 Error]

- Component GUI Layer in Main Camera for Scene Assets/Scenes/InGame.unity is no longer available. It will be removed after you edit this GameObject and save the Scene. UnityEditor.SceneManagement.EditorSceneManager:OpenScene(String)

[빌드 할 때 Error]

- Component GUI Layer in Main Camera for Scene Assets/Scenes/InGame.unity is no longer available. It will be removed after you edit this GameObject and save the Scene. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

- Component at index 2 could not be loaded when loading game object 'Main Camera'. Removing it!
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

  -> 해당 Scene으로 가서 Hierarchy에서 임의 수정 후 Save 하면 해결 됨.

 

[Error:3 참조]

Baroni 2020년 8월 12일 오전 6:43

All of them can be ignored. Just open the scenes once and save them.

[참조링크] www.rebound-games.com/forum/topic/2485/networkmanager-networkscenename-cannot-be-used-in-this-context-because-the-set-accessor-is-inaccessible/5

반응형
Posted by blueasa
, |

[추가] Android / iOS 방식이 달라서 플랫폼에 따라 Two Letter ISO 받는 방식을 다르게 적용

 

    /// <summary>
    /// Two Letter ISO Language
    /// [참조] https://lonewolfonline.net/list-net-culture-country-codes/
    /// [참조] https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
    /// </summary>
    /// <returns></returns>
    public static string GetTwoLetterISOLanguage()
    {
        string strCurrentCultureName = "en";
#if UNITY_EDITOR
        strCurrentCultureName = "en";
#elif UNITY_ANDROID
        strCurrentCultureName = GetTwoLetterISOLanguage_Android();
#elif UNITY_IOS || UNITY_IPHONE
        strCurrentCultureName = GetTwoLetterISOLanguage_iOS();
#endif
        return strCurrentCultureName;
    }

    public static string GetTwoLetterISOLanguage_iOS()
    {
        string strTwoLetterISOLanguageName = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
        Debug.LogFormat("[GetCurrentCultureName_iOS] {0}", strTwoLetterISOLanguageName);
        return strTwoLetterISOLanguageName;
    }

    // returns "en" / "de" / "hi" / "th" / "ar" / ...
    public static string GetTwoLetterISOLanguage_Android()
    {
#if !UNITY_EDITOR && UNITY_ANDROID
        try
        {
            var locale = new AndroidJavaClass("java.util.Locale");
            var localeInst = locale.CallStatic<AndroidJavaObject>("getDefault");
            var name = localeInst.Call<string>("getLanguage");
            Debug.LogFormat("[getLanguage] {0}", name);
            return name;
        }
        catch (System.Exception e)
        {
            return "Error";
        }
#else
        return "Not supported";
#endif
    }

    // returns "eng" / "deu" / "hin" / ...
    public static string GetThreeLetterISOLanguage_Android()
    {
#if !UNITY_EDITOR && UNITY_ANDROID
        try
        {
            var locale = new AndroidJavaClass("java.util.Locale");
            var localeInst = locale.CallStatic<AndroidJavaObject>("getDefault");
            var name = localeInst.Call<string>("getISO3Language");
            Debug.LogFormat("[getISO3Language] {0}", name);
            return name;
        }
        catch (System.Exception e)
        {
            return "Error";
        }
#else
        return "Not supported";
#endif
    }

[출처]

answers.unity.com/questions/729801/using-applicationsystemlanguage-returns-unknown.html?_ga=2.105896064.227436567.1600081424-730033693.1580204381

 

Using Application.systemLanguage returns Unknown - Unity Answers

 

answers.unity.com

 

 

[참조]

You should also be able to use .NET to get the current culture instead:

using System;
using System.Globalization;
using System.Threading;

CultureInfo myCulture = Thread.CurrentThread.CurrentCulture;


// You can then use all these member variables
myCulture.DisplayName
myCulture.EnglishName
myCulture.Name (e.g. es-ES / en-GB)
myCulture.Parent (e.g. es / en)
myCulture.ThreeLetterISOLanguageName (e.g. spa/eng/hin)
myCulture.TwoLetterISOLanguageName (e.g. es/en/hi)

 

Here's a selection of the Indian 3 and 2 letter ISO codes (see attached jpg)

 

[출처] forum.unity.com/threads/automatically-set-hindi-language.624973/

 

Automatically set Hindi language

As you all know it's possible to use SystemLanguage to detect the default language of the device running the game. When my game opens, i use it to...

forum.unity.com

 

반응형
Posted by blueasa
, |
using System;
using Mono.Data.Sqlite;

public class Example
{

    static void Main() 
    {
        string cs = "URI=file:test.db";        
        
        using (SqliteConnection con = new SqliteConnection(cs)) 
        {
            con.Open();

            using(SqliteTransaction tr = con.BeginTransaction())
            {
                using (SqliteCommand cmd = con.CreateCommand())
                {

                    cmd.Transaction = tr;
                    cmd.CommandText = "DROP TABLE IF EXISTS Friends";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = @"CREATE TABLE Friends(Id INTEGER PRIMARY KEY, 
                                        Name TEXT)";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Tom')";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Rebecca')";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Jim')";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Robert')";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Julian')";
                    cmd.ExecuteNonQuery();
                    cmd.CommandText = "INSERT INTO Friends(Name) VALUES ('Jane')";
                    cmd.ExecuteNonQuery();
                }

                tr.Commit();
            }

            con.Close();
        }
    }
}

 


출처: https://unsigned.tistory.com/entry/Sqlite-Insert-속도-문제시 [공부하자 공부공부]

 

Sqlite Insert 속도 문제시

using System; using Mono.Data.Sqlite; public class Example { static void Main() { string cs = "URI=file:test.db"; using (SqliteConnection con = new SqliteConnection(cs)) { con.Open(); using(SqliteTr..

unsigned.tistory.com

 

 

반응형
Posted by blueasa
, |

[추가]

- 상대경로 기준 : 프로젝트 폴더

 

프로젝트 하위 폴더

프로젝트 하위에 위와 같이 Keystore 폴더 아래 debug.keystore 파일이 있을 때 상대경로는 아래와 같다.

[상대경로] ./Keysotre/debug.keystore

 

----------------------------------------------------------------------------------------------------------

유니티의 안드로이드 빌드 환경을 설정에서 키스토어 파일을 등록할 때, 일반적으로 Browe Keystore 버튼으로 파일을 등록하게 되면 위 사진과 같이 절대경로가 설정된다.

 

자동 빌드 환경이나, 서로 다른 빌드 머신에서 빌드하고자 할 때 굉장히 짜증나는 부분이며 제대로된 해결 방법은 없고 편법을 사용해야 하는 것을 보인다.

 

유니티 상단 메뉴 -> Edit -> Project Settings -> Editor -> Asset Serialization

값을 Force Text 로 변경한다.

이 작업은 다른 설정 또는 .unity 파일도 모두 변경합니다.

 

프로젝트 경로 -> ProjectSettings 폴더 -> ProjectSettings.asset 을 열면 텍스트로 변환되어 있다. 이중 AndroidKeystoreName 을 검색하여 절대 경로를 상대 경로로 변경한다.

 

유니티를 다시 실행시켜 결과를 확인한다.

 

 

빌드 머신에서 실행해 결과를 확인한다.



출처: https://pjc0247.tistory.com/44 [pjc0247]

 

[Unity] Android keystore 경로 상대경로로 지정하기

유니티의 안드로이드 빌드 환경을 설정에서 키스토어 파일을 등록할 때, 일반적으로 Browe Keystore 버튼으로 파일을 등록하게 되면 위 사진과 같이 절대경로가 설정된다. 자동 빌드 환경이나, 서로

pjc0247.tistory.com

 

반응형
Posted by blueasa
, |

 

[링크] https://mentum.tistory.com/376

 

유니티 프로모션용 영상/동영상 촬영

유니티에서 프로모션 영상을 제작할 때 1. 에디터에서 OBS 등으로 직접 영상 촬영 2. 디바이스에 넣은 상태로 영상촬영 정도로 프로모션 영상 소스를 제작하곤 했는데, iOS용 프로모션 동영상을 만들 때 문제가 되..

mentum.tistory.com

 

반응형
Posted by blueasa
, |