레이어 끼리의 충돌 무시하기

|

Physics2D.IgnoreLayerCollision(8,9);


Start함수에 이걸 적어주면 해당되는 번호의 레이어끼리는 충돌을 무시한다.

레이어 번호는 Tags & Layers 에서 볼수 있다.


아래는 API







Physics2D.IgnoreLayerCollision

static void IgnoreLayerCollision(int layer1, int layer2, bool ignore = true);
Parameters

layer1ID of the first layer.
layer2ID of the second layer.
ignoreShould collisions between these layers be ignored?
Description

Choose whether to detect or ignore collisions between a specified pair of layers.


Trackback 0 And Comment 0

유니티 내에서 List 사용시

|

using System.Collections.Generic;를 추가해줘야 된다.

private List<GameObject> _objList = new List<GameObject>(); 이런식으로 선언후



_objList .Add(gameObject) ; ->이런식으로 추가할수있다.


참조할때는 배열 처럼 참조하면된다.

Vector3 pos = _objList[0].transform.position; 

이런식으로

Trackback 0 And Comment 0

유니티 2D 배경에 카메라 맞추기

|

배경화면에 꽉 차게 카메라를 맞추는 방법

스프라이트의 Pixels To Units 값에 의해서 결정된다.

디폴트 값은 100이며 만약 배경화면의 높이가 640이라고 하면. 유니티 상에서는 6.4 유닛이 되며

그 절반인 3.2 를 카메라의 사이즈에 대입하면 딱 맞게 화면에 보여진다.


관련 표 다.



Trackback 0 And Comment 0