응용프로그램 146

Unity - 자습서 - 인터페이스

※ 동영상과 동영상이 말하는 내용만 적혀있습니다. 나중에 까먹을때 보려고 메모하듯이 적어놓은 겁니다. 인터페이스와 요소 Interface OverviewThe Scene ViewThe Game ViewThe Hierarchy and Parent-Child relationshipThe Project Panel and ImportingThe InspecterBuild and Player SettingsIntroduction on the Profiler Essential Unity Concepts Game Object and Components Prefabs - Concept & UsageTagsLayers Extending the Unity Editor Building a Custom Inspector Ad..

유니티 - Collider 접촉이벤트

참조 : http://cpp11.tistory.com/13 충돌이 일어나기 위해서는 GameObject가 모두 Collider을 가지고 있어야 하고 둘 중하나는 Rigidbody를 가지고 있어야 한다. 3D용 충돌처리OnTriggerEnterOnTriggerStayOnTriggerExit OnCollisionExitOnCollisionStayOnCollisionEnter void OnTriggerEnter(Collider other) { Debug.Log ("접촉콜리더: "+other.name); if (other.tag == "Player") { Debug.Log ("플레이어 접촉"); } } 2D용 충돌처리OnCollisionExit2DOnCollisionStay2DOnCollisionEnter2D ..

유니티 씬이동

씬 이동하기. 현재 켜져 있는 씬 저장하기 -> Title로 저장 현재 켜져 있는 씬 다른이름으로 씬 저장하기 -> Main으로 저장 File -> Build Setting -> 씬 드래그 ▷ 숫자로 이동하기 File -> Build Setting -> 씬이름 옆에 숫자확인 C# 스크립트 만들고 TitleTemp로 지정 using UnityEngine.SceneManagement; OnMouseDown () { //Debug.Log ("button Click"); SceneManager.LoadScene(1); } ▷ 씬 이름으로 이동하기. File -> Build Setting -> 씬이름 확인. using UnityEngine.SceneManagement; OnMouseDown () { //Debug..

유니티 버튼

유니티 실행하고 폴더위치 지정 Main 카메라 : Position : 0, 0, -10Projection : OrthographicSize : 10Clipping Planes (Near:0.3, far: 10~20) 작업위치 -> Assets -> Image -> 이위치에 PNG 그림 저장 Unity 화면에 PNG 파일 드래그Hierarchy에서 PNG그림파일 선택 -> Add Component -> Physics 2D -> Box Collider 2D C# 스크립트 만들고 OnMouseDown (){ Debug.log("버튼클릭");} 삽입 후 하이러키의 PNG파일을 클릭하고 C# 스크립트 추가 후 실행!

Unity - Editor 개념 및 사용

※ 참조 Sebastian Lague 나르메님 블로그 에디터1 나르메님 블로그 에디터2 유니티 EditorGUILayout 레퍼런스 (데이터 타입 모음) 유니티 GUILayout 레퍼런스 (게임 실행시의 GUI 모음) Editor란 무었일가? - Inspector 변경값을 실시간으로 반영하고 싶을 때 사용. - 아래의 그림과 같은 Inspector에 팝업형태의 버튼을 넣고 싶을때 사용 Editor의 사용 반드시 Editor라는 폴더에 스크립트가 존재해야 동작한다. MapEditor.cs using UnityEditor; [CustomEditor (typeof(MapGenerator)), CanEditMultipleObjects] public class MapEditor : Editor{ public ov..

Unity - 근접했을때도 발사체 동작하게 하기

근접했을때도 발사체 동작하게 하기 출처 : Sebastian Lague Projectile.cs using UnityEngine; using System.Collections; public class Projectile : MonoBehaviour { public LayerMask collisionMask; float speed = 10; float damage = 1; float lifetime = 3; float skinWidth = 0.1f; void Start() { Destroy(gameObject, lifetime); Collider[] initialCollisions = Physics.OverlapSphere (transform.position, 0.1f, collisionMask); // ..

Unity - 적 공격으로 Player에게 데미지 입히기

적 공격으로 Player 데미지 입히기 출처 : Sebastian Lague IDeamageable.cs using UnityEngine; public interface IDamageable { void TakeHit(float damage, RaycastHit hit); void TakeDamage(float damage); } LivingEntity.cs using UnityEngine; using System.Collections; public class LivingEntity : MonoBehaviour, IDamageable { public float startingHealth; protected float health; protected bool dead; public event System...