[펌] 자주 틀리는 우리말 맞춤법
'한글' 카테고리의 다른 글
[펌] "개나 소나"에 대하여... (0) | 2020.07.07 |
---|---|
[펌] 한국인이 가장 많이 틀리는 맞춤법 (0) | 2018.11.13 |
[펌] '구별하다'와 '구분하다'의 차이 (0) | 2018.01.30 |
[펌] '개수'와 '갯수'의 바른 표현 (0) | 2016.09.30 |
[펌] 고자질의 어원 (0) | 2016.05.09 |
[펌] "개나 소나"에 대하여... (0) | 2020.07.07 |
---|---|
[펌] 한국인이 가장 많이 틀리는 맞춤법 (0) | 2018.11.13 |
[펌] '구별하다'와 '구분하다'의 차이 (0) | 2018.01.30 |
[펌] '개수'와 '갯수'의 바른 표현 (0) | 2016.09.30 |
[펌] 고자질의 어원 (0) | 2016.05.09 |
If you need to execute some long running task on the background in Unity, you may find this tool I just wrote, useful. This is BackgroundWorker for Unity 3D
You will only need the class BackgroundWorker
It worth noting that a lot of seemingly background tasks can be implemented with Unity Coroutines. For example using WWW service to send or receive data from a remote server. Or any case where we just wait for a response from a remote computer.
However because coroutines run on the main thread if you really have a long running, not just waiting for response but computing intensely something, you will need to run it on a background thread. Here is how you use this tool:
And then on each frame execute:
The tool has been tested on Windows, Mac, iPhone, and Android.
This is a sample usage of the BackgroundWorker class.
[펌] Unity Excel Importer (0) | 2019.01.03 |
---|---|
[링크] Emoji_Extension (0) | 2018.06.07 |
[Link] UnityAppNameLocalizationForIOS (0) | 2018.03.27 |
[에셋] Anti-Cheat Toolkit (0) | 2018.03.06 |
[펌] UnityIPhoneXSupport (0) | 2017.11.10 |
<블로그 원문은 여기에서 확인하실 수 있으며, 블로그 번역 리뷰는 양찬석(Google)님이 참여해 주셨습니다.>
func recordGameOver() { let tracker = GAI.sharedInstance().defaultTracker let gameOverEvent = GAIDictionaryBuilder.createEvent(withCategory: "gameOver", action: "totalScore", label: "", value: myGameStats.totalScore as NSNumber) let enemiesBeatenEvent = GAIDictionaryBuilder.createEvent(withCategory: "gameOver", action: "enemiesBeaten", label: "", value: myGameStats.enemiesBeaten as NSNumber) let roundsSurvivedEvent = GAIDictionaryBuilder.createEvent(withCategory: "gameOver", action: "roundsSurvived", label: "", value: myGameStats.roundsSurvived as NSNumber) tracker?.send(gameOverEvent.build() as [NSObject: AnyObject]) tracker?.send(enemiesBeatenEvent.build() as [NSObject: AnyObject]) tracker?.send(roundsSurvivedEvent.build() as [NSObject: AnyObject]) }
FIRAnalytics.logEvent(withName: "gameOverTotalScore", parameters: [kFIRParameterValue: myGameStats.totalScore as NSObject]) FIRAnalytics.logEvent(withName: "gameOverEnemiesBeaten", parameters: [kFIRParameterValue: myGameStats.totalScore as NSObject]) FIRAnalytics.logEvent(withName: "gameOverTotalScore", parameters: [kFIRParameterValue: myGameStats.totalScore as NSObject])
let finalStats = ["totalScore": myGameStats.totalScore as NSObject, "enemiesBeaten": myGameStats.enemiesBeaten as NSObject, "roundsSurvived": myGameStats.roundsSurvived as NSObject] FIRAnalytics.logEvent(withName: "gameOver", parameters: finalStats)
GoogleService-info.plist
파일을 생성하고 추가했습니다. 하지만 Firebase Analytics를 올바로 구성하려면 또 하나의 GoogleService-info.plist
파일을 생성하고 Xcode 프로젝트에 추가하기도 해야 합니다. 이 두 가지를 모두 어떻게 수행할 수 있을까요?GoogleService-info
파일을 다시 다운로드하세요.TRACKING_ID
항목이 보일 것입니다. 이전의 GoogleService-info
파일을 이 새로운 파일로 바꾸고 나머지 Firebase 설치 프로세스를 진행하면 바로 사용할 수 있습니다.func recordGameOver() { // All the old code you had previously to record Google Analytics // … // … So much code … // … // Now add the Firebase stuff let finalStats = ["totalScore": myGameStats.totalScore as NSObject, "enemiesBeaten": myGameStats.enemiesBeaten as NSObject, "roundsSurvived": myGameStats.roundsSurvived as NSObject] FIRAnalytics.logEvent(withName: "gameOver", parameters: finalStats) }
func recordGameOver() { let finalStats = ["totalScore": myGameStats.totalScore as NSObject, "enemiesBeaten": myGameStats.enemiesBeaten as NSObject, "roundsSurvived": myGameStats.roundsSurvived as NSObject] FIRAnalytics.logEvent(withName: "gameOver", parameters: finalStats) // That's it! }
SELECT AVG(hit.eventInfo.eventValue) FROM `my_awesome_app.ga_sessions_20170123`, UNNEST(hits) AS hit WHERE hit.eventInfo.eventCategory = "gameOver" AND hit.eventInfo.eventAction = "totalScore"이제 Firebase Analytics로 전환합시다. 클라이언트에서 Firebase Analytics에 대해서만 호출하는 이전 예시의 간단한 구현을 사용할 수 있습니다.
func recordGameOver() { let finalStats = ["totalScore": myGameStats.totalScore as NSObject, "enemiesBeaten": myGameStats.enemiesBeaten as NSObject, "roundsSurvived": myGameStats.roundsSurvived as NSObject] FIRAnalytics.logEvent(withName: "gameOver", parameters: finalStats) // That's it! }그리고 시간에 따라 무찌른 평균 적군 수를 보려면 두 데이터 세트를 병합해야 합니다. 이를 위한 SQL은 다음과 비슷한 내용일 것입니다.
SELECT COUNT(*), AVG(total_score) AS average FROM ( SELECT event_param.value.int_value AS total_score FROM `firebase-project.com_example_awesome_app.app_events_20170123`, UNNEST(event_dim) AS event, UNNEST(event.params) AS event_param WHERE event.name = "gameOver" AND event_param.key = "totalScore" UNION ALL SELECT hit.eventInfo.eventValue AS total_score FROM `my_awesome_app.ga_sessions_20170123`, UNNEST(hits) AS hit WHERE hit.eventInfo.eventCategory = "gameOver" AND hit.eventInfo.eventAction = "totalScore" )
[출처] https://developers-kr.googleblog.com/2017/03/how-do-i-add-firebase-analytics-to-app.html
[펌] iOS 리모트 프로파일링(Remote profiling) (0) | 2018.06.29 |
---|---|
[펌] How to 100% check internet availability (0) | 2018.06.28 |
Unity app stops background music(앱 실행 시, 타 앱 사운드 끄기) (0) | 2018.04.19 |
[펌/수정] Get size of an online assetbundle and progress in Kb ? (0) | 2018.04.18 |
[펌] How to detect iPhone X or iPad using iOS.DeviceGeneration? (0) | 2018.03.09 |
이벤트 당첨은 몇 달 된 것 같은데
드디어 받은 게임코디 장패드!!
갓뎀버그 귀엽네요. :)
[스케치] 고딩 때 그린 그림 (0) | 2020.01.05 |
---|---|
[펌] 추억의 게임 '그루브파티' (0) | 2018.02.08 |
[Try & Error] 2017 티스토리 결산 (0) | 2018.01.07 |
우리집 무화과 & 부모님 (1) | 2015.10.05 |
[MUD] [2015-09-13] 마계지문 재오픈 (6) | 2015.09.14 |
[펌] 윈도우10 설정 ms-settings 명령어 활용하기 (0) | 2019.03.05 |
---|---|
[Link] Using Google analytics and Google firebase at the same time (0) | 2018.09.05 |
[펌] NotePad++ 에서 , -> 엔터(\n)로 변환(줄바꿈) (0) | 2018.05.17 |
[펌] 윈도우7 업데이트 0% 문제 해결 (0) | 2018.03.25 |
[펌][Chrome] 바탕화면에 사용자 바로가기 추가하기 (0) | 2018.03.22 |
[사이트] Unity List(Unity3D open source search engine) (0) | 2021.03.05 |
---|---|
[링크] 캐릭터/애니메이션 판매 사이트(유니티 사용 가능) (0) | 2020.06.18 |
[Unity] Google Play Game Service 연동시키기 (0) | 2016.07.26 |
[Link] RhythmTool (0) | 2016.06.21 |
[Link] Visualizer Studio (0) | 2016.06.21 |
Unity 5.6’s release made some changes to the default sprite shader which make parts of the shader in the following post invalid. At the bottom of this post you’ll find an updated version of the demo project that works in Unity 5.6.
Unity provides a component to outline UI objects, but it doesn’t work on world space sprites. This post will demonstrate a simple way to add outlines to sprites using an extended version of the default sprite shader along with a simple component. This could be used to highlight sprites on mouse over, highlight items in the environment, or just to make sprites stand out from their surroundings.
To begin, create a new shader in your project called Sprite-Outline
. This shader provides all the functionality of the default sprite shader, with the additions to allow sprite outlines.
Shader "Sprites/Outline"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
// Add values to determine if outlining is enabled and outline color.
[PerRendererData] _Outline ("Outline", Float) = 0
[PerRendererData] _OutlineColor("Outline Color", Color) = (1,1,1,1)
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ PIXELSNAP_ON
#pragma shader_feature ETC1_EXTERNAL_ALPHA
#include "UnityCG.cginc"
struct appdata_t
{
float4 vertex : POSITION;
float4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
struct v2f
{
float4 vertex : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord : TEXCOORD0;
};
fixed4 _Color;
float _Outline;
fixed4 _OutlineColor;
v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap (OUT.vertex);
#endif
return OUT;
}
sampler2D _MainTex;
sampler2D _AlphaTex;
float4 _MainTex_TexelSize;
fixed4 SampleSpriteTexture (float2 uv)
{
fixed4 color = tex2D (_MainTex, uv);
#if ETC1_EXTERNAL_ALPHA
// get the color from an external texture (usecase: Alpha support for ETC1 on android)
color.a = tex2D (_AlphaTex, uv).r;
#endif //ETC1_EXTERNAL_ALPHA
return color;
}
fixed4 frag(v2f IN) : SV_Target
{
fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
// If outline is enabled and there is a pixel, try to draw an outline.
if (_Outline > 0 && c.a != 0) {
// Get the neighbouring four pixels.
fixed4 pixelUp = tex2D(_MainTex, IN.texcoord + fixed2(0, _MainTex_TexelSize.y));
fixed4 pixelDown = tex2D(_MainTex, IN.texcoord - fixed2(0, _MainTex_TexelSize.y));
fixed4 pixelRight = tex2D(_MainTex, IN.texcoord + fixed2(_MainTex_TexelSize.x, 0));
fixed4 pixelLeft = tex2D(_MainTex, IN.texcoord - fixed2(_MainTex_TexelSize.x, 0));
// If one of the neighbouring pixels is invisible, we render an outline.
if (pixelUp.a * pixelDown.a * pixelRight.a * pixelLeft.a == 0) {
c.rgba = fixed4(1, 1, 1, 1) * _OutlineColor;
}
}
c.rgb *= c.a;
return c;
}
ENDCG
}
}
}
Now create a new material called SpriteOutline
and assign the newly created shader to it in the inspector.
Next create a new C# script and name it SpriteOutline
. This component is going to handle updating our material in the editor and at runtime to toggle the outline off or on and also change the color. This component can also be targetted in an animation to enable or disable outlines for specific animation frames or to change the outline color.
using UnityEngine;
[ExecuteInEditMode]
public class SpriteOutline : MonoBehaviour {
public Color color = Color.white;
private SpriteRenderer spriteRenderer;
void OnEnable() {
spriteRenderer = GetComponent<SpriteRenderer>();
UpdateOutline(true);
}
void OnDisable() {
UpdateOutline(false);
}
void Update() {
UpdateOutline(true);
}
void UpdateOutline(bool outline) {
MaterialPropertyBlock mpb = new MaterialPropertyBlock();
spriteRenderer.GetPropertyBlock(mpb);
mpb.SetFloat("_Outline", outline ? 1f : 0);
mpb.SetColor("_OutlineColor", color);
spriteRenderer.SetPropertyBlock(mpb);
}
}
Now that the hard work is done, add a few sprites to your scene. Change the material field of the SpriteRenderer
component to the SpriteOutline
material created above. You’ll also want to add the SpriteOutline
component to this game object to show a white outline by default. To hide the outline simply disable or remove the component.
With all that completed, you should now have a sprite with a white outline. In the inspector you can change the color to anything you’d like, independently from the SpriteRenderer
color. The custom shader also maintains all existing functionality of the default sprite shader.
Please download the demo project and play around with it to get a better idea of how this technique looks and works. It contains a single scene with three examples of outlined sprites, one of which is animated.
Shaders can be complicated, but they are very powerful and make it quite easy to implement graphical features, even in 2D. If you have any further questions please feel free to message me on Twitter @RyanNielson or comment below.
Some people have been asking about how to change the thickness of the sprite outlines. Please download this new demo project with the changes to add this functionality. Changes were made to both the shader and component. Just adjust the outline size slider on the sprite outline component to change outline size. There is a limited outline size of 16 to prevent issues with shader for loop unrolling. It hasn’t been tested throughly, so your results may vary, but it’s probably a good place to start.
Unity 5.6 has been released, and along with that came some changes to the default sprite shader. Unfortunetely this seems to be causing issues with parts of the method used above. Please download this new demo project which changes the sprite outline shader to incorporate the 5.6 shader changes.
[출처] https://nielson.io/2016/04/2d-sprite-outlines-in-unity/
[Link] Rim lighting and realtime shadows for sprites in Unity (2D) (0) | 2019.08.19 |
---|---|
[펌] 유니티에서 셰이더로 원, 둥근 사각형 만들기 (0) | 2019.08.06 |
[펌] Super-Blur: Screen and UI gaussian blur for Unity (0) | 2017.02.09 |
[펌] Dvornik Unity Distortion (0) | 2016.08.31 |
[펌] 휘어지는 효과 렌더링 (0) | 2016.05.16 |
[펌] [iOS] info.plist Key 목록과 사용. (0) | 2018.03.26 |
---|---|
[펌] 안드로이드 개발 Wi-Fi Mac Address 알아오기, IP주소 가져오기 관련 (0) | 2016.05.02 |
Breakpad Client Libraries (0) | 2015.02.26 |
유니티에서 안드로이드 빌드 할려고 할 때
Error building Player: CommandInvokationFailure: Unable to merge android manifests. See the Console for more details
이런 에러가 뜨면서 안되는 경우 안에 내용을 살펴 보면
Main manifest has <uses-sdk android:targetSdkVersion='21'>but library uses targetSdkVersion='23' 이런 내용이 있다
무슨 뜻 이냐면 자신의 컴에 깔린 안드로이드 sdk 최신 버전은 21인데 프로젝트안에 어떤 플로그인에서 안드로이드 타겟버전을 23을 셋팅 되어서 빌드를 못한다는 뜻임.
그냥 안드로이드sdk버전업만 시키면 빌드가 다시 잘된다.!!
출처: http://jaehogame.tistory.com/entry/유니티-Error-building-Player-CommandInvokationFailure-Unable-to-merge-android-manifests-See-the-Console-for-more-details [재호와 함께하는 게임프로그래밍~~ㅋㅋ]
[링크] linker command failed with exit code 1 (use -v to see invocation) (7) | 2019.01.03 |
---|---|
[펌] 유니티 페이스북SDK Error OpenSSL, JDK 환경변수 등록 - Your Android setup is not correct. See Settings in Facebook menu (0) | 2018.07.18 |
[Bug] A script behaviour (script unknown or not yet loaded) has a different serialization layout when loading. (0) | 2018.01.17 |
[iOS] Google Analytics doesn't work on new iOS project (0) | 2017.11.08 |
[링크] 애플, macOS에서 확인되지 않은 개발자가 배포한 앱 실행하는 옵션 삭제... 우회로는 남겨놔 (0) | 2017.07.28 |
1. 'Alt + H'
2. 찾을 내용 : ,
3. 검색 모드-확장(\n, \r, \t, \0, \x...) 체크
4. 바꿀내용 : \n
5. 모두 바꾸기(A) 클릭
6. 줄바꿈 완료
[Link] Using Google analytics and Google firebase at the same time (0) | 2018.09.05 |
---|---|
[링크][카카오 욕필터] 새버전 (0) | 2018.05.21 |
[펌] 윈도우7 업데이트 0% 문제 해결 (0) | 2018.03.25 |
[펌][Chrome] 바탕화면에 사용자 바로가기 추가하기 (0) | 2018.03.22 |
[FreeSound] Sonniss: 효과음 번들 무료배포 (0) | 2018.03.21 |