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

카테고리

분류 전체보기 (2843)
Unity3D (891)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (188)
협업 (64)
3DS Max (3)
Game (12)
Utility (140)
Etc (99)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (52)
Android (16)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (19)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday

배포시 가장 큰 골치덩어리중 하나는 AndroidManifest.xml 파일 수정문제일 것이다.
Android Plugin을 만들어서 넣자니 짜증나고... 그럴때 간단하게 AndroidManifest.xml 파일을 수정할 수 있는 방법을 공개한다.

프로젝트 Root폴더에 보면 "Temp" 폴더가 생성되어 있을텐데 거길 가만히 보면 "StagingArea"라는 폴더가 보인다.
여기로 들어가면 다음과 같이 폴더가 구성되어 있다.

빌드에서 사용될 각종 Resource 파일들이 보일텐데 이중에 필요한건 
AndroidManifest.xml 파일과 res 폴더 두개이다. 이 2개를 선택해서 CTRL+C 해서 복사하고 
유니티로 돌아와서 "Plugins" 폴더를 만든다음 다시 "Android"폴더를 만들고 거기에 복사해 넣자.

이제 복사한 AndroidManifest.xml 파일을 열어서 마음대로 주무르면 됨. 끝!

 

[출처] http://www.wolfpack.pe.kr/872

 

Unity3D AndroidManifest.xml 파일 Custom으로 수정하고자 할때

트랙백 주소 :: 이 글에는 트랙백을 보낼 수 없습니다

www.wolfpack.pe.kr

 

반응형
Posted by blueasa
, |

[펌] UnityCoverFlow

Unity3D/UGUI / 2019. 5. 14. 17:23

UnityCoverFlow

Unity3D UI CoverFlow and other Layout options

Overview

Some years ago I was required to build a simple Cover Flow Layout (think, iTunes Carousel). Originally I build the project in a Windows Forms application for a client we were working with. Sometime later we then needed a similar system in a project we were doing in Unity3D.

This is just a simple recreation of that work.

Its very old, and it wasn’t originally done in GitHub so I’ve just commited the whole project in one commit.

There are some simple layouts included to demonstrate the flexibility of the system,

  • The classic Cover Flow layout (iTunes Album Artwork style)
  • A Carousel Layout (Z-Depth carousel)
  • A “Messy Paper” Layout - Cells shift from 1 messy pile to another

Further Features

Cell reuse is supported using a simple Cell Pool with UICollectionCells registering Prefabs as “nibs” to be reused.

Data “binding” can be expanded upon with the cell reuse.

All layouts have various settings to tweak positions, speeds, snapping, wrapping and the like. These can also be updated at runtime in the editor to see results in real time.

Demos

Here’s a few GIFs showing the layouts in action in the editor (GIFs are only at 30fps and appear to have bad artifacts in them, running in the editor is obviously at full FPS with no rendering issues).

  • Cover Flow Layout 

  • Carousel Layout 

  • Messy Paper Layout 

  • Layouts can have multiple configurable elements, here’s an example of the Cover Flow properties being edited at runtime…

 

[출처] https://unitylist.com/p/1xt/Unity-Cover-Flow

 

Unity Cover Flow

Unity3D UI CoverFlow and other Layout options

unitylist.com

 

반응형
Posted by blueasa
, |

It forces to sample current state of animations. "Sample animations" means: put character in the position defined by animation states. Sampling always happens between Update and LateUpdate automatically, but in some cases you might want to sample animations yourself. My most common case: I want to put character in pose of first frame some specific animation on Start, so I would do something like this:

 

void Start() 
{ 
	AnimationState state = animation["Aim"]; 
	state.enabled = true; 
	state.weight = 1; 
	state.normalizedTime = 0;

	animation.Sample();
}

 

[출처] https://answers.unity.com/questions/46869/animationsample-usage.html

반응형
Posted by blueasa
, |
반응형
Posted by blueasa
, |

 

[링크]

https://github.com/setchi/FancyScrollView

 

setchi/FancyScrollView

A scrollview component that can implement highly flexible animation. - setchi/FancyScrollView

github.com

 

FancyScrollView 

English (by Google Translate)

高度に柔軟なアニメーションを実装できる汎用の ScrollView コンポーネントです。 無限スクロールもサポートしています。

 

 

Requirements

Installation

Unity Asset Store

Asset Store からパッケージをプロジェクトにインストールします。

Unity Package Manager (Example scenes not included)

プロジェクトディレクトリの Packages/manifest.json ファイルにリポジトリへの参照を追加します。

{ "dependencies": { "jp.setchi.fancyscrollview": "https://github.com/setchi/FancyScrollView.git#upm" } }

Manual

このリポジトリを Clone または Download します。

Features

自由にスクロールアニメーションを実装できます

FancyScrollView はセルの位置を更新するとき、可視領域の正規化された値を各セルに渡します。セル側では、0.0 ~ 1.0 の値に基づいてスクロールの外観を自由に制御できます。サンプルでは Animator を使用してセルの動きを制御しています。

データ件数が多くても軽快に動作します

表示に必要なセル数のみが生成され、セルは再利用されます。

セルとスクロールビュー間で自由にメッセージのやりとりができます

Context 経由で、セルがクリックされたことをスクロールビューで検知したり、スクロールビューからセルに指示を出す処理がシンプルに実装できます。実装例(Examples/02_FocusOn)が含まれていますので、参考にしてください。

特定のセルにスクロールやジャンプができます

移動にかける秒数や Easing の指定もできます。詳しくは API Reference の Scroller - Methods を参照してください。

スクロールの挙動を細かく設定できます

慣性の有無、減速率などスクロールに関する挙動の設定ができます。詳しくは API Reference の Scroller - Inspector を参照してください。

スナップをサポートしています

スナップを有効にすると、スクロールが止まる直前に最寄りのセルへ移動します。スナップがはじまる速度のしきい値、移動にかける秒数、 Easing を指定できます。

無限スクロールをサポートしています

Inspector で下記の設定をすることで無限スクロールを実装できます。

  1. FancyScrollView  Loop をオンにするとセルが循環し、先頭のセルの前に末尾のセル、末尾のセルの後に先頭のセルが並ぶようになります。
  2. サンプルで使用されている Scroller を使うときは、 Movement Type  Unrestricted に設定することで、スクロール範囲が無制限になります。 1. と組み合わせることで無限スクロールを実現できます。

実装例(Examples/03_InfiniteScroll)が含まれていますので、こちらも参考にしてください。

Examples

FancyScrollView/Examples を参照してください。

NameDescription

01_Basic 最もシンプルな構成の実装例です。
02_FocusOn ボタンで左右のセルにフォーカスする実装例です。
03_InfiniteScroll 無限スクロールの実装例です。

Usage

もっともシンプルな構成では、

  • セルにデータを渡すためのオブジェクト
  • セル
  • スクロールビュー

の実装が必要です。

Implementation

セルにデータを渡すためのオブジェクトを定義します。

public class ItemData { public string Message; }

FancyScrollViewCell<TItemData> を継承して自分のセルを実装します。

using UnityEngine; using UnityEngine.UI; using FancyScrollView; public class MyScrollViewCell : FancyScrollViewCell<ItemData> { [SerializeField] Text message = default; public override void UpdateContent(ItemData itemData) { message.text = itemData.Message; } public override void UpdatePosition(float position) { // position は 0.0 ~ 1.0 の値です // position に基づいてスクロールの外観を自由に制御できます } }

FancyScrollView<TItemData> を継承して自分のスクロールビューを実装します。

using UnityEngine; using System.Linq; using FancyScrollView; public class MyScrollView : FancyScrollView<ItemData> { [SerializeField] Scroller scroller = default; [SerializeField] GameObject cellPrefab = default; protected override GameObject CellPrefab => cellPrefab; void Start() { scroller.OnValueChanged(base.UpdatePosition); } public void UpdateData(IList<ItemData> items) { base.UpdateContents(items); scroller.SetTotalCount(items.Count); } }

スクロールビューにデータを流し込みます。

using UnityEngine; using System.Linq; public class EntryPoint : MonoBehaviour { [SerializeField] MyScrollView myScrollView = default; void Start() { var items = Enumerable.Range(0, 20) .Select(i => new ItemData {Message = $"Cell {i}"}) .ToArray(); myScrollView.UpdateData(items); } }


API Reference

FancyScrollView<TItemData, TContext>

セルを制御するスクロールビューの抽象基底クラスです。

public abstract class FancyScrollView<TItemData, TContext> : MonoBehaviour where TContext : class, new()

Context が不要な場合はこちらを使用します。

public abstract class FancyScrollView<TItemData> : FancyScrollView<TItemData, FancyScrollViewNullContext>

Inspector

TypeNameSummary

float Cell Spacing セル同士の間隔を float.Epsilon ~ 1.0 の間で指定します.
float Scroll Offset スクロールのオフセットを指定します.たとえば、 0.5 を指定してスクロール位置が 0 の場合、最初のセルの位置は 0.5 になります.
bool Loop オンにするとセルが循環し、最初のセルの前に最後のセル、最後のセルの後に最初のセルが並ぶようになります.無限スクロールさせたい場合はオンにします.
Transform Cell Container セルの親要素となる Transform を指定します.

Properties

TypeNameSummary

GameObject CellPrefab Cell prefab.
IList<TItemData> ItemsSource Items source.
TContext Context Context.

Methods

TypeNameSummary

void UpdateContents(IList<TItemData> itemsSource) Updates the contents.
void Refresh() Refreshes the cells.
void UpdatePosition(float position) Updates the scroll position.

FancyScrollViewCell<TItemData, TContext>

セルの抽象基底クラスです。

public abstract class FancyScrollViewCell<TItemData, TContext> : MonoBehaviour where TContext : class, new()

Context が不要な場合はこちらを使用します。

public abstract class FancyScrollViewCell<TItemData> : FancyScrollViewCell<TItemData, FancyScrollViewNullContext>

Properties

TypeNameSummary

int Index Gets or sets the index of the data.
bool IsVisible Gets a value indicating whether this cell is visible.
TContext Context Context.

Methods

TypeNameSummary

void SetupContext(TContext context) Setup the context.
void SetVisible(bool visible) Sets the visible.
void UpdateContent(TItemData itemData) Updates the content.
void UpdatePosition(float position) Updates the position.

Scroller

スクロール位置を制御するコンポーネントです。

public class Scroller : UIBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler

Inspector

TypeNameSummary

RectTransform Viewport ビューポートとなる RectTransform を指定します.ここで指定された RectTransform の範囲内でジェスチャーの検出を行います.
ScrollDirection Direction Of Recognize ジェスチャーを認識する方向を Vertical か Horizontal で指定します.
MovementType Movement Type コンテンツがスクロール範囲を越えて移動するときに使用する挙動を指定します.
float Elasticity コンテンツがスクロール範囲を越えて移動するときに使用する弾力性の量を指定します.
float Scroll Sensitivity スクロールの感度を指定します.
bool Inertia 慣性のオン/オフを指定します.
float Deceleration Rate Inertia がオンの場合のみ有効です.減速率を指定します.
bool Snap.Enable Snap を有効にする場合オンにします.
float Snap.Velocity Threshold Snap がはじまる閾値となる速度を指定します.
float Snap.Duration Snap 時の移動時間を秒数で指定します.
Ease Snap.Easing Snap 時の Easing を指定します.

Methods

TypeNameSummary

void OnValueChanged(Action<float> callback) スクロール位置が変化したときのコールバックを設定します.
void OnSelectionChanged(Action<int> callback) 選択セルが変化したときのコールバックを設定します.
void JumpTo(int index) 指定したセルまでジャンプします.
void ScrollTo(int index, float duration) 指定したセルまでスクロールします.
void ScrollTo(int index, float duration, Ease easing) 指定したセルまでスクロールします.
void ScrollTo(int index, float duration, Func<float, float> easingFunction) 指定したセルまでスクロールします.
void SetTotalCount(int totalCount) アイテムの総数を設定します. ( index: 0 ~ totalCount - 1 )

Author

setchi

License

MIT

반응형
Posted by blueasa
, |

NIST 타임서버에서 시간가져오기 (NST)

아래와 같은 코드로 가져올 수 있다.
Unity 에서 사용할 수 있다.

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

public class TimeServer : MonoBehaviour {

    [SerializeField]
    private string _comment = "만료시킬 날짜를 적으세요 (한국시각 기준)";

    public int _yyyy, _mm, _dd;
    private DateTime _expireDateTime, _nowServerDateTime, _nowLocalDateTime;
    private TimeSpan _duration;

 // Use this for initialization
 void Start () {

        // 한국 시각
        _duration = System.TimeSpan.FromHours(9);
        _expireDateTime = new DateTime(Mathf.Clamp(_yyyy, 1900, 3000), Mathf.Clamp(_mm, 1,12), Mathf.Clamp(_dd, 1, 31));

        _nowLocalDateTime = DateTime.Now;
        _nowServerDateTime = GetNISTDate().Add(_duration);

        if (Debug.isDebugBuild)
        {
            Debug.LogWarning("만료지정일 : " + _expireDateTime);
            Debug.LogWarning("현재 로컬 시각 :" + _nowLocalDateTime);
            Debug.LogWarning("현재 서버 시각 :" + _nowServerDateTime);
        }

        if (_nowLocalDateTime < _expireDateTime)
        {
            if (_nowServerDateTime < _expireDateTime)
            {
                // Debug.Log("실행");
            }
            else
            {
                // Debug.Log("서버 체크 결과 만료 됨");
            }
        }
        else
        {
            // Debug.Log("로컬 체크 결과 만료 됨");
        }


    }

#region NTPTIME

    //NTP time 을 NIST 에서 가져오기
    // 4초 이내에 한번 이상 요청 하면, ip가 차단됩니다.

    public static DateTime GetDummyDate()
    {
        return new DateTime(2017, 12, 24); //to check if we have an online date or not.
    }

    public static DateTime GetNISTDate()
    {
        System.Random ran = new System.Random(DateTime.Now.Millisecond);
        DateTime date = GetDummyDate();
        string serverResponse = string.Empty;

        // NIST 서버 목록
        string[] servers = new string[] {
        "time.bora.net",
        //"time.nuri.net",
        //"ntp.kornet.net",
        //"time.kriss.re.kr",
        //"time.nist.gov",
        //"maths.kaist.ac.kr",
        "nist1-ny.ustiming.org",
        "time-a.nist.gov",
        "nist1-chi.ustiming.org",
        "time.nist.gov",
        "ntp-nist.ldsbc.edu",
        "nist1-la.ustiming.org"
    };

        // 너무 많은 요청으로 인한 차단을 피하기 위해 한 서버씩 순환한다. 5번만 시도한다.
        for (int i = 0; i < 5; i++)
        {
            try
            {
                // StreamReader(무작위 서버)
                StreamReader reader = new StreamReader(new System.Net.Sockets.TcpClient(servers[ran.Next(0, servers.Length)], 13).GetStream());
                serverResponse = reader.ReadToEnd();
                reader.Close();

                // 서버 리스폰스를 표시한다. (디버그 확인용)
                if (Debug.isDebugBuild)
                    Debug.Log(serverResponse);

                // 시그니처가 있는지 확인한다.
                if (serverResponse.Length > 47 && serverResponse.Substring(38, 9).Equals("UTC(NIST)"))
                {
                    // 날짜 파싱
                    int jd = int.Parse(serverResponse.Substring(1, 5));
                    int yr = int.Parse(serverResponse.Substring(7, 2));
                    int mo = int.Parse(serverResponse.Substring(10, 2));
                    int dy = int.Parse(serverResponse.Substring(13, 2));
                    int hr = int.Parse(serverResponse.Substring(16, 2));
                    int mm = int.Parse(serverResponse.Substring(19, 2));
                    int sc = int.Parse(serverResponse.Substring(22, 2));

                    if (jd > 51544)
                        yr += 2000;
                    else
                        yr += 1999;

                    date = new DateTime(yr, mo, dy, hr, mm, sc);

                    // Exit the loop
                    break;
                }
            }
            catch (Exception e)
            {
                /* 아무것도 하지 않고 다음 서버를 시도한다. */
            }
        }
        return date;
    }
    #endregion
}

아래 코드 원본에서 주석 변경 및 내가 사용하기 위해 수정함.
경로 : https://stackoverflow.com/questions/516788/getting-current-gmt-time

 

[출처] http://blog.kpaper.com/2017/10/unity-nst-nist.html

반응형
Posted by blueasa
, |
반응형
Posted by blueasa
, |
반응형
Posted by blueasa
, |

dependency 걸려 있는 파일이 없다는 내용.

Unity에서 Firebase Analytics 패키지 추가 후에 해당 에러가 나서 이런 저런 테스트 결과 아래와 같이 해결 했음.

 

1) Assets >> Play Services Resolver >> Android Resolver >> Resolve 실행

2) Unity3D 에디터 재시작

 

[출처] https://github.com/firebase/quickstart-unity/issues/44

 

Authentication: "One or more Firebase dependencies are not present" · Issue #44 · firebase/quickstart-unity

When I start the authentication app in Android, I receive the error below: "One or more Firebase dependencies are not present. Current dependency status: UnavailableOther" Can someone hel...

github.com

 

반응형
Posted by blueasa
, |

[링크] https://bitbucket.org/vitaly_chashin/simpleunitybrowser

반응형
Posted by blueasa
, |