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

카테고리

분류 전체보기 (2077)
Unity3D (462)
Programming (453)
Unreal (2)
Gamebryo (56)
Tip & Tech (157)
협업 (23)
3DS Max (3)
Game (12)
Utility (97)
Etc (86)
Link (29)
Portfolio (18)
Subject (90)
iPhone (30)
Android (2)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (1)
Memories (16)
Interest (36)
Thinking (29)
한글 (23)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (14)
Exercise (3)
나만의 맛집 (2)
냥이 (7)
육아 (2)
Total1,058,850
Today7
Yesterday214
Statistics Graph

달력

« » 2017.06
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30  

공지사항

태그목록

Tistory Cumulus Flash tag cloud by BLUEnLIVE requires Flash Player 9 or better.

우선, 유니티에서 Window -> Services 합니다.



그러고 나면 Inspector 옆에 Services라는 텝이 생기는데 

Select Organization 하고 Create 해줍니다.



그러면 유니티에서 제공하는 Service들이 보일 것입니다.

그 중에, OFF상태인 In-App Purchasing 텝을 클릭합니다.



우측상단에 있는 토글을 눌러 OFF되어있던 상태를 ON으로 만들어줍니다.

그리고 13세 이하 어린이에게 지도감독이 필요한 지 여부를 선택하고 Save Changes 합니다.



이제, 프로젝트에 In-App Purchasing이 활성화 된 모습을 보실 수 있을 것입니다.

여기서 잊지말고 Import 버튼을 꼬옥 눌러줍니다!



프로젝트 뷰에 Unity IAP 플러그인이 제대로 임포트 된 모습입니다.



이제 기본 세팅이 다 되었습니다. 그렇다면 코딩을 해볼까요?

아래와 같이 Script를 작성합니다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
using System;
using UnityEngine;
using UnityEngine.Purchasing;
 
public class InAppPurchaser : MonoBehaviour, IStoreListener
{
    private static IStoreController storeController;
    private static IExtensionProvider extensionProvider;
 
    #region 상품ID
    // 상품ID는 구글 개발자 콘솔에 등록한 상품ID와 동일하게 해주세요.
    public const string productId1 = "gem1";
    public const string productId2 = "gem2";
    public const string productId3 = "gem3";
    public const string productId4 = "gem4";
    public const string productId5 = "gem5";
    #endregion
 
    void Start()
    {
        InitializePurchasing();
    }
 
    private bool IsInitialized()
    {
        return (storeController != null && extensionProvider != null);
    }
 
    public void InitializePurchasing()
    {
        if (IsInitialized())
            return;
 
        var module = StandardPurchasingModule.Instance();
 
        ConfigurationBuilder builder = ConfigurationBuilder.Instance(module);
 
        builder.AddProduct(productId1, ProductType.Consumable, new IDs
        {
            { productId1, AppleAppStore.Name },
            { productId1, GooglePlay.Name },
        });
 
        builder.AddProduct(productId2, ProductType.Consumable, new IDs
        {
            { productId2, AppleAppStore.Name },
            { productId2, GooglePlay.Name }, }
        );
 
        builder.AddProduct(productId3, ProductType.Consumable, new IDs
        {
            { productId3, AppleAppStore.Name },
            { productId3, GooglePlay.Name },
        });
 
        builder.AddProduct(productId4, ProductType.Consumable, new IDs
        {
            { productId4, AppleAppStore.Name },
            { productId4, GooglePlay.Name },
        });
 
        builder.AddProduct(productId5, ProductType.Consumable, new IDs
        {
            { productId5, AppleAppStore.Name },
            { productId5, GooglePlay.Name },
        });
 
        UnityPurchasing.Initialize(this, builder);
    }
 
    public void BuyProductID(string productId)
    {
        try
        {
            if (IsInitialized())
            {
                Product p = storeController.products.WithID(productId);
 
                if (p != null && p.availableToPurchase)
                {
                    Debug.Log(string.Format("Purchasing product asychronously: '{0}'", p.definition.id));
                    storeController.InitiatePurchase(p);
                }
                else
                {
                    Debug.Log("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
                }
            }
            else
            {
                Debug.Log("BuyProductID FAIL. Not initialized.");
            }
        }
        catch (Exception e)
        {
            Debug.Log("BuyProductID: FAIL. Exception during purchase. " + e);
        }
    }
 
    public void RestorePurchase()
    {
        if (!IsInitialized())
        {
            Debug.Log("RestorePurchases FAIL. Not initialized.");
            return;
        }
 
        if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.OSXPlayer)
        {
            Debug.Log("RestorePurchases started ...");
 
            var apple = extensionProvider.GetExtension<IAppleExtensions>();
 
            apple.RestoreTransactions
                (
                    (result) => { Debug.Log("RestorePurchases continuing: " + result + ". If no further messages, no purchases available to restore."); }
                );
        }
        else
        {
            Debug.Log("RestorePurchases FAIL. Not supported on this platform. Current = " + Application.platform);
        }
    }
 
    public void OnInitialized(IStoreController sc, IExtensionProvider ep)
    {
        Debug.Log("OnInitialized : PASS");
 
        storeController = sc;
        extensionProvider = ep;
    }
 
    public void OnInitializeFailed(InitializationFailureReason reason)
    {
        Debug.Log("OnInitializeFailed InitializationFailureReason:" + reason);
    }
 
    public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs args)
    {
        Debug.Log(string.Format("ProcessPurchase: PASS. Product: '{0}'", args.purchasedProduct.definition.id));
 
        switch (args.purchasedProduct.definition.id)
        {
            case productId1:
 
                // ex) gem 10개 지급
 
                break;
 
            case productId2:
 
                // ex) gem 50개 지급
 
                break;
 
            case productId3:
 
                // ex) gem 100개 지급
 
                break;
 
            case productId4:
 
                // ex) gem 300개 지급
 
                break;
 
            case productId5:
 
                // ex) gem 500개 지급
 
                break;
        }
 
        return PurchaseProcessingResult.Complete;
    }
 
    public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason)
    {
        Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason));
    }
}
 
cs



결제를 진행해야하는 부분에서 


위의 BuyProductID 함수의 파라미터로 상품ID를 넣고 콜(구매요청)하면


product가 initialize된 후 ProcessPurchase로 결과가 넘어오는데


args.purchasedProduct.definition.id로 구매요청된 상품ID를 판별하여


상품에 맞는 보상을 지급해주면 됩니다. 참 쉽죠?


유니티 5.3버전 이전에는(유니티가 자체 IAP를 지원하기 전) Android와 iOS 각각 따로 결제시스템을 만들어야했는데


지금은 Android와 iOS를 동시에 지원해주기 때문에 정말 편하답니다~


    


결제된 정보는 구글 Payments 판매자 센터에서 확인하실 수 있습니다. (https://wallet.google.com/merchant)



출처: http://minhyeokism.tistory.com/47 [programmer-dominic.kim]



저작자 표시 비영리 동일 조건 변경 허락
신고

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

[Unity3D] Unity In App Purchasing / In App Billing - iOS & Android  (0) 2017.06.19
Posted by blueasa
TAG iap, Unity

댓글을 달아 주세요

[File]

BigInteger.zip




BigInteger


現時点、unityでサポートされている.Netのバージョンは3.5相当となっている(2015/01/15現在)
この事から.Net4.0からサポートされたクラスは利用できない状態となっている


C#コードを利用した幾何解析などの演算では、扱う数字の桁数に制限がない BigInteger クラスが必要になる場合がある
そこで、検索を利用して探してみるとMITライセンスの BigInteger クラスが公開されていたので、これを利用する事にした
unityが将来.Net4.0をサポートした時の事を考え、このMIT版BigInteger に少し改編を施す。利用側のコード改編が必要ない形にしておく


資料:


<雛形とするBigIntegerクラス>


<unity用に名前空間を書き換えたBigIntegerクラス>
Scott Garland氏が作成されたBigIntegerクラスです。ライセンスはMITライセンスとして指定されています。これを使えばunityでBigIntegerの機能が利用できます
コード内の名前空間に「ScottGarland」が使われているのでこの部分を「System.Numerics」に書き換えunityの将来のバージョンアップに備えます
(少し行儀の悪い方法ですが一時的な利用になると予想しています)



ダウンロードした「BigInteger.cs」ファイルをunityのAssetsフォルダ内にコピーし「System.Numerics」名前空間を経由して他のコードから利用する事にします
当サイト内でBigIntegerをサンプルコード内で利用する場合、unityが.Net4.0に対応するまでは、このクラスを利用します



[출처] http://unitylab.wiki.fc2.com/wiki/BigInteger

저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa

댓글을 달아 주세요


[링크http://lhh3520.tistory.com/315



[추가]

Unity Analytics도 Offline 일 때,

Cache에 저장해둔 후, Online이 되면 전송함


[참조

Our SDK caches events that are sent if the request fails for any reason(e.g. no internet connection) after it reaches the retry threshold.
Once there's an internet connection, we resend the cached events.


[참조 출처]

https://forum.unity3d.com/threads/is-unity-analytics-a-best-effort-delivery-service-offline-unreliable-connections.311369/

저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa

댓글을 달아 주세요

[링크] https://www.codeandweb.com/texturepacker



[링크] Quickstart Guide with TexturePacker and Unity





Tutorials for Unity:
Sprite Sheets &
Normal Mapped Sprites

We currently have 2 detailed tutorials for Unity,
scroll down for our Quickstart Guide.











Quickstart Guide with TexturePacker and Unity

This overview shows you how to create your first sprite sheet and import it into your unity project.

These 6 steps will cost you only 5 minutes - but make your development much easier. Promised!

1.
Open TexturePacker, select
Unity - Texture2D sprite sheet
as framework.

TexturePacker: Select Unity Texture2D as framework

2.
Add sprites ...

Drag & drop sprites
onto TexturePacker.


... or folders

TexturePacker adds
all sprites inside the folder
and updates the texture
when the content changes.

Add Sprites to TexturePacker


3.
Set output files
Make sure to set the output path of both files inside the Assets folder of your Unity project.



Set the output path for your files


4.
Optional: Set Trim mode and Pivot Point.

Crop removes transparency from sprites, allowing a better packing ratio.




5.

Click Publish sprite sheet to write the sprite sheet to your Unity project




6.

Download and install our free
TexturePacker Importer
TexturePacker Importer
Free download from Unity Asset Store 

The sprite sheet is updated after each publish.




TexturePacker allows you to set a Pivot Point and Trim your sprite





TexturePacker: Click Publish sprite sheet







Your files will be imported automatically when using TexturePacker Importer





저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa

댓글을 달아 주세요


Link : https://aws.amazon.com/ko/documentation/sdk-for-unity/

저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa
TAG aws, Unity

댓글을 달아 주세요

문서들을 여기 저기 따로 공유하려느 번거로워서 유니티 최적화 관련 문서들을 모아두었습니다. 정리는 두서 없이 했고,다만 출처가 유니티 크루인지 아닌지로만 분류하였습니다. 추가적으로 발견하는 대로 지속적으로 갱신 할 예정입니다.


From Unity


from Developers


출처 : http://ozlael.tistory.com/32

저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa

댓글을 달아 주세요

요점은..

1) Unity-Edit-Project Settings-Editor 이동

2) Version Control : Visible Meta Files

3) Asset Serialization : Force Text

4) Assets 폴더와 ProjectSettings 폴더만 Commit (나머지는 가능하면 svn ignore 등록)






유니티 공식 문서

http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html

 

1. Enable Meta files in Edit->Project Settings->Editor

2. 유니티를 한번 실행하고 나서 세이브 후 끈다.( 공식문서엔 실행은 없으나 보다 확실하게 하려고.. )

3.  Library 폴더를 삭제한다.

4. 프로젝트 폴더를 svn 에 추가 후 커밋

 

아래부터는 협업시 체크아웃순서

 

5. svn 의 프로젝트 폴더를 체크아웃 후 유니티에서 프로젝트를 왼쪽 알트키( 맥에선 option 키 )를 누른 상태로 연다.( 선택하는 화면이 2번 나온다 )

6. 재밌게 협업 시작

 

 

참고로 Library 폴더의 커밋을 방지하기 위해서 Asset의 ignore 목록에 Library 폴더와 temp 폴더를 추가시키는게 좋다.

 

인자 좀 살 것 같다...휴:D



[출처] Unity3D SVN 연동 방법|작성자 php_


저작자 표시 비영리 동일 조건 변경 허락
신고

'협업 > SVN' 카테고리의 다른 글

Unity SVN 연동  (0) 2014.04.11
Unity3D SVN 연동 방법  (0) 2014.01.03
Unity3D SVN 연동방법  (0) 2012.12.25
Posted by blueasa
TAG svn, Unity

댓글을 달아 주세요

I was working on a library in Unity that was using a lot of 3D text and therefore was requiring a lot of draw calls. This got me thinking, since all the pieces of text were on the same orientation plane would there be a way instead to draw all the text to a one texture and render that instead. Another benefit of doing this would be you could then apply text at runtime to a non-flat mesh via a texture. This would allow you to do cool things like personalizing a player’s jersey with the user’s name, localizing complex in-game advertisements, etc. So I decided to look into this. What started as a few experiments turned into not so small project.

Doing research I found a way of achieving this using Render Texture. What you could do was by using either with GUI text or 3D Text place a camera to capture a single frame and render it to a texture. While not completely straightforward or easy it does work and allows quite a bit of flexibility on what you are creating. This method does come with a drawback, it needs Render Texture support. Only Unity Pro supports Render Texture, plus they are not supported on the iPhone (Unity Feature Breakdown).

Since my goal was to create a library that all Unity developers could use, this was not an acceptable solution.

My next idea was to manually draw the text to a texture using SetPixels. While the performance of writing to a texture using SetPixels is less than ideal, I only needed to do this once.
Note: The reason why this is so slow is after calling setPixel(s) you have to call Apply which send the whole texture to the GPU. The Apply method is unfortunately very slow, but is “usable” if you are not needing to call it repeatedly.

I thought developing this using this method shouldn’t be too bad as I knew when you import a font into Unity, Unity automatically creates a texture containing the font. What I didn’t anticipate was that the letters were not in a grid format, but places tightly together. With no runtime access to letter position data, this was not going to work.

Next on my list was Custom Font, a feature where you can “easily” create your own font in Unity. With Custom Font you supply your own font image laid out in a grid. Using this method I could determine where the letters were positioned. I now needed a way create a font image in a grid pattern and get all the Per Character Kerning values from a font.

In digging through the internet I came across a few mentions of something called the Unity Font Mapper. It took me a very long time but I finally tracked down a link to the app: http://loewald.com/unity/unityfontmapper.zip. This Mac application not only generates the font image in a grid pattern, but generates a file containing the Per Character Kerning information.

Once I had a Custom Font working I then discovered there is no programming access to any of its properties (I still use Custom Font as part of my final solution in hopes at some point access will be opened up to those values). This means these values now needed to be entered twice if you want to use the same font for both a Text-to-Texture font and as a regular font.

I now had all the pieces and it was just a matter of putting it all together. While the current version of this code is far from perfect and is missing features like colored text it does exactly what I wanted it to do.

To check out the demo click here.

To get the source (unitypackage) click here.

To get only the TextToTexture class (TextToTexture.cs) click here.

Source Requirements: Unity 2.6

Setup Steps

  1. Create a font image in a grid pattern and collect kerning values (either manually or using the Unity Font Mapper)
  2. Import the font image(texture) into Unity and select ‘Build Alpha From Grayscale’ and set ‘Is Readable’ to true.
  3. Add this texture to a material
  4. Within Unity create a Custom Font. If you aren’t wanting to use this font for anything but Text-to-Texture you can just setup the basics and ignore the Per Character Kerning values within the Custom Font (these take a long time to enter)
  5. Create a script that calls TextToTexture and passes all the required information (example in source: AddTextToTexture.cs)

Note: I used a Decal material in this demo so the text would appear on top of the primary texture. But you can use any material that you wish.



출처 : http://blog.almostlogical.com/2010/08/20/adding-text-to-texture-at-runtime-in-unity3d-without-using-render-texture/

저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa

댓글을 달아 주세요

Unity3d Hotkeys

Unity3D/Tips / 2013.11.04 10:43

- Default HotKey와 Custom Hotkey 추가 방법.





Review_Notes_Unity3d_Hotkeys.pdf


출처 : http://www.walkerboystudio.com/Review_Notes_Unity3d_Hotkeys.pdf




[Add]


- Toggle Active GameObject in Hierarchy : Alt + Shift + A


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




[Add]

- Expand/Collapse All in Hierarchy : Alt + L-Button



저작자 표시 비영리 동일 조건 변경 허락
신고
Posted by blueasa
TAG Hotkey, Unity

댓글을 달아 주세요

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

저작자 표시 비영리 동일 조건 변경 허락
신고

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

iOS 디바이스 별 메모리 사용 한계치  (0) 2013.07.02
Max Texture Size of iOS Devices  (0) 2013.06.14
게임 중 일시정지 하기  (0) 2013.05.30
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

댓글을 달아 주세요

티스토리 툴바