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

카테고리

분류 전체보기 (2849)
Unity3D (893)
Programming (479)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (189)
협업 (64)
3DS Max (3)
Game (12)
Utility (141)
Etc (99)
Link (34)
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

에셋번들을 만들기 위해서는 먼저 에셋번들로 만들 리소스를 분류해야한다.

프로젝트 뷰에서 리소스를 클릭하면 아래와 같은 뷰를 볼 수 있는데

이 뷰의 하단에 AssetBundle의 리스트 박스가 있다.

디폴트는 None 으로 되어있는데 New를 사용하여 새로운 에셋번들 이름을 정할 수 있다.

에셋번들로 사용할 리소스의 에셋번들 이름을 설정해 준다.




헌데 에셋번들 이름만 설정하는 것으로는 에셋번들이 자동적으로 생성되지 않는다.

때문에 직접 코드를 작성해야한다.

1
2
3
4
5
6
7
8
9
10
11
12
using UnityEngine;
using UnityEditor;
 
public class AssetBundleBuilder : Editor 
{
    [MenuItem("Assets/BuildBundle")]
    static void BuildBundle()
    {
        BuildPipeline.BuildAssetBundles("AssetBundles");
    }
}
 
cs

MenuItem을 사용하여 유니티의 Asset탭에 BuildBundle탭이 나타나게 하였다.

BuildPipeline을 이용하여 에셋번들의 이름이 지정된 리소스를 에셋번들로 만들어준다.

BuildAssetBundles는 에셋번들을 만들어주는 함수로 매개변수에는 에셋번들이 저장될 경로를 넣어주었다.


Asset탭에 BuildBundle탭이 생겼다.


사용해보면 에셋번들이 생성된다.




요롷게 지정해줬던 폴더에 Bundle 파일이 생성되었다. 

(아, 폴더가 미리 만들어져있지 않으면 에러를 뱉어냅니다. 폴더의 경로는 프로젝트 폴더 기준)



이제 이 에셋번들을 다운로드 할겁니다.

인터넷에 올려서 다운로드 할 수도 있지만 저는 로컬에서 받는 방식으로 해볼 것입니다.

저의 로컬 디렉터리 URL은 file:///C:/Users/UnderCode/Desktop/1.UnityTest/AssetBundleTest/bundle  입니다.

이 경로를 통해 bundle 파일을 받게 됩니다.


에셋번들을 다운로드 받는 방법은 크게 두가지가 있습니다.

WWW 클래스를 이용해서 그냥 다운 받거나

WWW.LoadFromCacheOrDownload() 함수를 이용하여 받는 방법입니다.

LoadFromCacheOrDownload() 함수는 에셋번들을 인터넷으로 부터 캐싱하여 받는 방식으로 cache 폴더에 저장됩니다.

다음에 다시 다운받을 때 하드디스크에 에셋번들이 있으면 하드디스크에 있는 에셋번들을 사용하고 없으면

 다운로드 받아서 사용합니다.



먼저 WWW를 이용하여 다운 받는 방법 

(string bundleURL = "file:///C:/Users/UnderCode/Desktop/1.UnityTest/AssetBundleTest/bundle";)

(AssetBundle bundle;)

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
    //방법 1
    IEnumerator AssetBundleLoad()
    {
        WWW www = new WWW(bundleURL);
 
        yield return www;
 
        bundle = www.assetBundle;
 
        AssetBundleRequest abr = bundle.LoadAssetAsync<Sprite>("TestImage");
        yield return abr;
        assetImage.sprite = (Sprite)abr.asset;
 
        abr = bundle.LoadAssetAsync<TextAsset>("AssetBundleTest");
        yield return abr;
        TextAsset textAsset = (TextAsset)abr.asset;
        assetText.text = textAsset.text;
 
        abr = bundle.LoadAssetAsync<AudioClip>("MazeMusic");
        yield return abr;
        assetAudio.clip = (AudioClip)abr.asset;
        assetAudio.Play();
 
        bundle.Unload(false);
    }
cs



LoadCacheOrDownload() 함수를 이용하는 방법

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
    //방법 2
    IEnumerator AssetBundleLoad()
    {
        while (!Caching.ready)
            yield return null;
 
        WWW www = WWW.LoadFromCacheOrDownload(bundleURL, bundleVer);
 
        yield return www;
 
        bundle = www.assetBundle;
 
        AssetBundleRequest abr = bundle.LoadAssetAsync<Sprite>("TestImage");
        yield return abr;
        assetImage.sprite = (Sprite)abr.asset;
 
        abr = bundle.LoadAssetAsync<TextAsset>("AssetBundleTest");
        yield return abr;
        TextAsset textAsset = (TextAsset)abr.asset;
        assetText.text = textAsset.text;
 
        abr = bundle.LoadAssetAsync<AudioClip>("MazeMusic");
        yield return abr;
        assetAudio.clip = (AudioClip)abr.asset;
        assetAudio.Play();
 
        bundle.Unload(false);
    }
cs



에셋번들에서 리소를 가져올 때는 리소스의 이름을 사용하여 리소스를 찾고(확장자는 필요 없음)

AssetBundleRequest를 이용하여 받습니다.



출처: http://undercode.tistory.com/21 [UnderCode]

반응형
Posted by blueasa
, |

[링크] ETC1 + Alpha

Unity3D/Tips / 2017. 4. 6. 17:36


[링크] http://twocap.tistory.com/11



[참조] https://www.assetstore.unity3d.com/kr/#!/content/23722

반응형
Posted by blueasa
, |

MAC OS
 ㄴ 어플리케이션 : ~/Library/Preferences
 ㄴ 웹플레이어 : ~/Library/Preferences/Unity/WebPlayerPrefs

unity.[company name].[product name].plist 파일


Windows OS
 ㄴ 어플리케이션 : 레지스트리 HKCU\Software\
 ㄴ 웹플레이어 : %APPDATA%\Unity\WebPlayerPrefs

\[company name]\[product name] 폴더


시작 단추, 실행을 차례로 누르고 REGEDIT를 입력




[출처] http://ancardwineugene.blogspot.kr/2015/07/unity3d-playerprefs.html

반응형
Posted by blueasa
, |
[키워드] MovieTexture, Handheld.PlayFullScreenMovie(path)


[링크] http://blog.naver.com/crazylulu/120173323897

반응형
Posted by blueasa
, |

[에러로그]

Google.JarResolver.ResolutionException: Cannot find candidate artifact for com.google.android.gms:play-services-analytics:9.4

  at Google.JarResolver.PlayServicesSupport.LoadDependencies (Boolean allClients) [0x00000] in <filename unknown>:0 

  at Google.JarResolver.PlayServicesSupport.CreateInstance (System.String clientName, System.String sdkPath, System.String[] additionalRepositories, System.String settingsDirectory) [0x00000] in <filename unknown>:0 

  at Google.JarResolver.PlayServicesSupport.CreateInstance (System.String clientName, System.String sdkPath, System.String settingsDirectory) [0x00000] in <filename unknown>:0 

  at GADependencies..cctor () [0x0000a] in 



[펌]

유니티 구글플레이 연동시에

ResolutionException: Cannot find candidate artifact for com.google.android.gms:play-services-games:8.1+ Google.JarResolver.PlayServicesSupport.DependOn (System.String group, System.String artifact, System.String version) 

뭐라뭐라 이런 에러날때 대처법.

1.​Edit - Preferences - ExternarTools 에서 sdk경로 제대로 들가있는지확인

2. 들가있는데 그러면 SDK Manager 열어서

Android Support Repository

Google Repository

이두가지 최신버전상태 혹은 인스톨되어있는지확인해서 깔아주면 끄읏​

http://howtoforge.answers.sc/gamedev/questions/111298/resolutionexception-cannot-find-candidate-artifact-for-com-google-android-gmsp.html



[출처]

http://jaehogame.tistory.com/entry/%EC%9C%A0%EB%8B%88%ED%8B%B0GoogleJarResolverPlayServicesSupportDependOn

반응형
Posted by blueasa
, |


[링크]

http://ronniej.sfuh.tk/%EC%95%A0%EC%85%8B-%EB%B2%88%EB%93%A4-%EA%B8%B0%EC%B4%88-assetbundle-fundamentals-2-%EB%B2%88%EC%97%AD/

반응형
Posted by blueasa
, |
  1. var fileStream : FileStream;
  2. //creating a folder for the Files
  3. var pathToAudioData : String = "ThePathWithFolderName";
  4. if (!Directory.Exists (pathToAudioData)){
  5. Directory.CreateDirectory (pathToAudioData);
  6. }
  7. var url: String = "http://www.TheURL.ch";
  8. var request : WWW = new WWW (url);
  9. yield request;
  10. File.WriteAllBytes(pathToAudioData+"/"+"xy.ogg", request.bytes);




[출처] http://answers.unity3d.com/questions/703879/download-and-save-ogg-files.html

반응형

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

Unity3D MonoBehaviour Lifecycle(흐름도)  (0) 2017.12.20
[펌] Unity BigInteger  (0) 2017.04.26
[펌] StreamingAssets 폴더 지정하기  (0) 2016.11.10
Invert ParticleEffect Velocity  (0) 2016.11.09
[펌] Parallax Scrolling  (0) 2016.10.27
Posted by blueasa
, |



Welcome to Part One. 

Integrating Steam into my Unity Project, ARENA 3D, has been a big challenge and I would to share some of the knowledge I have acquired since being Greenlit on Steam back in February.

This is Part One and I demonstrate a handful of Steam API features within ARENA 3D and go on to show the basics of installing the Steamworks .NET wrapper into your Unity Project and then recreating the Top Left Header which is found in the ARENA 3D Main Menu.

https://steamworks.github.io/ -- Steamworks .NET C# Wrapper
http://store.steampowered.com/app/438... -- ARENA 3D on Steam


반응형
Posted by blueasa
, |

구글 플레이 스토어와 안드로이드에서는 종종 설치가 불가능할 시 "패키지 파일이 올바르지 않습니다." 라는 오류 페세지를 표시합니다. 해당 문제 해결을 위한 몇 가지 해결 방법을 알려드립니다.

 

1) 인터넷 연결 설정을 바꾸어 봅니다.

3G, LTE 등의 데이터를 이용하고 계셨다면 Wi-Fi 로, Wi-Fi 를 이용하고 계셨다면 데이터를 사용하는 인터넷 연결 설정으로 바꾸어 보세요. 그리고 카닥 앱 다운로드나 업데이트를 다시 진행해 보시기 바랍니다.

 

2) 앱 삭제 이후 재설치를 해봅니다.

카닥 앱 삭제, 혹은 업데이트를 삭제했다 재설치해 보시기 바랍니다.

 

3) 구글 플레이스토어 데이터와 캐시를 지웁니다.

1. 설정 > 어플리케이션 관리 > 전체 어플리케이션 > Google Play Store > 데이터 지우기와 캐시 지우기

 

4) 구글 플레이 스토어 업데이트를 삭제해 봅니다.

1. 설정 > 어플리케이션 관리 > 전체 어플리케이션 : Google Play Store> 업데이트 삭제

2. Google Play Store 계정 로그아웃, 로그인 이후 기계 재부팅

3. 설정 > 어플리케이션 관리 > 전체 어플리케이션 > Google Service Framework > 데이터 지우기.



[출처]

https://cardocowner.zendesk.com/hc/ko/articles/204014055--%ED%8C%A8%ED%82%A4%EC%A7%80-%ED%8C%8C%EC%9D%BC%EC%9D%B4-%EC%98%AC%EB%B0%94%EB%A5%B4%EC%A7%80-%EC%95%8A%EC%8A%B5%EB%8B%88%EB%8B%A4-%EB%9D%BC%EB%8A%94-%EC%98%A4%EB%A5%98-%EB%A9%94%EC%8B%9C%EC%A7%80%EC%99%80-%ED%95%A8%EA%BB%98-%EC%84%A4%EC%B9%98%EA%B0%80-%EB%90%98%EC%A7%80-%EC%95%8A%EC%95%84%EC%9A%94-

반응형
Posted by blueasa
, |



Your Android setup is not correct. See Settings in Facebook menu. UnityEditor.HostView:OnGUI() Problem with sharing image to facebook..Facebook SDK - OpenSSL & Keytool

 Unity’s latest Facebook build target finally available as a Developer Beta Mode
 Publish your Unity 5.4 game onto a new Facebook Games platform for Windows
 Your android debug keystore file is missing [FIX]

Your Android setup is not correct. See Settings in Facebook  menu.UnityEditor.HostView:OnGUI()


The simple way to solve this error is installing OpenSSL.

1 - Download the OpenSSL installer (the x64 full package) here :http://slproweb.com/products/Win32OpenSSL.html (link to the file :http://slproweb.com/download/Win64OpenSSL-1_0_1f.exe)

If you are on older version of JavaSDK please update it. 
2 - Download the lastest x64 JavaSDK here (http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html).

 And are you using latest facebook SDK for desired unity version?
3 - Take a look here :https://developers.facebook.com/docs/unity/downloads/?campaign_id=282184128580929&placement=SDK_list


Must See:Optimizing Mobile Games in Unity


Now you have everything ready to solve this error!

Install OpenSSL on C:/ and open it  

Your Android setup is not correct.

And add its Environment Variables in windows Path.

Go to "Control Panel > System > Advanced system settings > Environment Variables" and select the Variable "Path" in the "System variables" window and click Edit. And finally, add the path to your OpenSSL bin folder to the end of the "Variable value" after a ";". For example, using "C:/OpenSSL" install folder, you'll type ";C:\OpenSSL-win64\bin".

 Your Android setup is not correct.


Now do the same for JavaSDK Install it and then add the environment variable. Using Java8, I have putted ";C:\Program Files\Java\jdk1.8.0\bin" just after openssl.

Now prompt commands working (like "keytool" or "openssl")  after adding these Variables.

 Your Android setup is not correct.


To let it work in unity please restart windows. Some times we never restart windows and stuck in errors again.
After restart you will probably not get into the warning like ''UnityEditor.HostView:OnGUI()" or "Keytool" etc.

Thanks! Good Luck
LIKE, SUBSCRIBE and SHARE :)




[출처] http://unity3diy.blogspot.kr/2016/06/solved-your-android-setup-is-not.html

반응형
Posted by blueasa
, |