[ 1. Setting up 3D Beginner ]
1. Setting up the Unity Editor
유니티 설치 체크
2. Creating a Project
새 프로젝트 생성
3. Importing the Assets
Package Import >> “3D Beginner: Tutorial Resources”
4. Unity Editor interface
Project Window
Console Window
Hierarchy Window
Scene View
Game View
Inspector Window
GameObject와 Component
5. Toolbar and Navigation UI
Play buttons
Play / Pause /Step
Manipulating objects
Hand Tool / Move Tool / Rotate Tool / Scale Tool / Rect Transform Tool (2D 만을 위한 move,scale,rotate가 가능한 도구)
Rotate, Move,Scale (세가지 기능을 다 할 수 있는 도구)
F 키 / 마우스 더블 클릭
Navigating with the mouse
left
middle + 드래그
right + 드래그 : 3D 모드에서 테스트
6. Layouts
2 by3 / 4 Split / Tall / Wide / Default
본인 Layout 만들어서 저장하기
[ 2. The Player Character: Part 1 ]
1. Save the Scene
씬 저장 : MainScene
2. Add a Character Model
[ 부연 설명 ]
[ GameObject 1 ] - GameObject에 대한 간단한 설명
[ 실습 ] Object Empty에서 "Cube Object" 만들기 - GameObject와 Component의 관계를 알 수 있음
Cube 생성 : 목적물
Object Empty : 초기
Mesh Filter
Box Collider
Mesh Renderer
Materials
Element : Default-Diffuse
[ Component 1 ] - Component들이 어떤 것들이 있는지를 간단하게 설명
Cube를 대상으로 설명( Empty Object에서 Cube 만들어 보기)
GameObject는 Component를 모아 놓은 Container
JohnLemon
Skinned Mesh Renderer
뼈대에 따라 변형되는 Bone 애니메이션의 렌더링
LeftforeArm 찾아서 회전해 보기
3. What are Prefabs?
[ 부연 설명]
Pre + fabricate : 미리 제작물을 만들어 놓은 것?
하나의 애셋(Asset)으로 프로젝트 뷰에 저장되어 있는 재사용 가능한 GameObject
Prefab을 Drag & Drop 으로 GameObject의 생성을 가능하게 해 줌
GameObject의 생성 및 관리를 수월하게 해줌
하나의 Resource로 여러 개의 GameObject를 생성하는 만큼 메모리의 효율도 높일 수 있음
Prefab 생성 방법
Project View >> Create >> Prefab
Hierachy View에 존재하는 GameObject를 Drag하여 Project View로 가지고 오는 방법
Prefab의 특징
Prefab에 있는 속성을 바꾸게 되면, 기존에 이 Prefab을 사용하고 있는 모든 GameObject도 속성이 바뀌게 됨
만약 바뀌게 하고 싶지 않으면, GameObject의 이름을 바꿔 주면 됨
Prefab Menu - GameObject의 Inspector에 위치한 메뉴
Select : GameObject와 연결된 Prefab을 표시해 줌
Apply : 현재 GameObject의 변경 사항을 Prefab에 적용
Revert : Prefab에 설정된 값으로 다시 되돌림
4. Turn the Character into a Prefab
Prefab 만들기
Prefab 작업(">", Open)
Auto Save
Overrides
5. Animate your character
6. Create the Animator Controller
Animator Controller 생성 : JohnLemon
Animator parameter
float / int / bool / trigger
parameter 생성 : isWalking(Bool)
7. Set Up the Animations
만들어진 animation clip(idle,walk) 체크
Animator에 Idle.anim Drag
Defalut state 설명
8. Create Animator Transitions
Idle <--> Walk : Make Transition
Has Exit Time >> disable
9. Add Conditions to your Transition
conditions(IsWalking) 처리
10. Assign the Animator Controller to the JohnLemon Prefab
만든 JohnLemon (Animator Controller) 적용
11. Make your Character React to Physics
Rigidbody 추가
Apply Root Motion 체크
12. What is Root Motion?
13. What is the Update loop?
14. Fix John Lemon's Movement
15. Coordinates in Unity
16. Positions and Rotation
17. Add a Collider to John Lemon
18. Summary
[ 3. Player Character: Part 2 ]
1. The Player Character Continued
Script 설명
using / public / MonoBehaviours
[부연 설명 ]
[ 실습 ] Console 창에 Start/Update가 실행될 때마다 Console 창에 메시지를 출력할 수 있도록 함
Cube 생성
Script 생성
Start : "Start ... " 출력될 수 있도록
Update : "Update 1" ~ "Update 100" 까지 출력될 수 있도록
2. Create your First Script (PlayerMovement)
3. Create variables for the Horizontal and Vertical axes
4. How Did You Create That Variable?
5. Make a Vector
6. Set the Values for your Variable
7. Set up the Animator component
Mathf.Approximately : 2개의 파라미터 값이 거의 같은 경우 true, 그렇지 않은 경우 false를 리턴
8. Create a variable to store a reference to the Animator component
9. Get a reference to the Animator component
참고 : GetComponet 참조
10. Set up the reference to the Animator component
11. Create a Rotation for Your Character
12. Adjust the turnSpeed variable
Vector3.RotateTowards (transform.forward, m_Movement, turnSpeed * Time.deltaTime, 0f);
선형 보간을 통해 부드럽게 턴을 할 수 있도록 하는 함수
forward : 현재 벡터, m_Movement : 목적 벡터, turnSpedd*Time.deltaTime : 목적 벡터까지 이르기 위한 변위 각속도
13. Apply Movement and Rotation to your Character
MonoBehaviour.OnAnimatorMove() : 애니메이션의 루트 모션 움직임 처리 콜백 함수 ( 자동적으로 호출되는 함수 )
Animator에서 제공되는 애니메이션을 스크립트를 통해 제어(변화)할 수 있는 메소드
14. Movement
OnAnimatorMove() 함수를 구현하면, Animator 컴포넌트의 ApplyRootMotion 부분이 Handleheld by Script 가 됨
15. Rotation
16. Change your Update Method
17. Test your Changes
18. Adjust your Game View Settings
19. Summary
[ 4.The Environment ]
1. Add the Environment
Assets>prefabs> Level (prefab)
John Lemone 위치 => (-9.8, 0, -3.2)
2. Light the Environment
3. Change the Directional Light in your Scene
Directional Light
Light Color : 225, 240, 250
Intensity : 2
Light > Realtime Shadows => 으스스한 그림자 연출
Resolustion : Use Quality Settings >> Very High Resolution
Bias, Normal Bias : 0.01
Transform : Rotation : (30,20,0)
4. Create a Global Illumination Lightmapping Effect
Window > Rendering > Light
Scene 섹션
Realtime Lighting > Realtime Global Illumination : uncheck
Mixed Global Illumination : uncheck
Environmnet 섹션
Envioronment Lighting
Source > Gradient
Sky : (170,180,200)
Equator : (90,110, 130)
Ground : (0, 0, 0)
5. Adding a Navigation Mesh
Level(gameObject) > Static 으로 변경(자식까지)
Level > Corrideors > Dressing > Ceiling Plane : static 선택을 해제
Scene 저장
6. Create the NavMesh
Window > AI > Navigation
Bake 탭
Agent Radius : 0.25
Bake 버튼 클
7. Summary
[ 5.The Camera ]
1. Explore the Camera Component
2. How does Cinemachine work?
하나 이상의 가상 카메라
가상 카메라는 Cinemachine Brain 컴포넌트에서 관리
3. Set up a Virtual Camera using Cinemachine
Cinemachine > Create Virtual Camera
Cinemachine Brain 컴포넌트가 Main Camera에 자동 생성됨
이제 가상 카메라가 씬을 지배함
4. Change the Cinemachine Virtual Camera Component Settings
Cinemachine Virtual Camera
Follow : <- JohnLemon
Look At :
Body : Transposer -> Framing Transposer
Aim : Composer -> Do Nothing
CM vcam1 : rotation (45, 0, 0)
Cinemachine Virtual Camera > Body
Camera Distance : 8
Dead Zone Width/Height : 0.1
5. Add Post-Processing Effects
https://docs.unity3d.com/Manual/PostProcessingOverview.html
6. Create a Post-Processing Layer
Layer 생성 > Add Layer > PostProcessingVolumes(User Layer 8)
Main Camera > Post Process Layer 컴포넌트 추가
Post Process Layer > Volume blending > Layer : PostProcessingVoulumes
7. Improve Image Quality with Anti-aliasing
Post Process Layer > Anti aliasing > Mode : Fast Approximate Anti-aliasing(FXAA)
Fast Mode : check
8. Create a Post-Processing Volume
Create > Create Empty
name : GlobalPost
Layer : PostProcessingVolumes
Position : (0, 0,0)
Post Process Volume 컴포넌트
Is Global : check
profile => New 클릭 ( Assets > Scenes : MainScene_Profiles 폴더 생성됨)
9. Add the Color Grading Effect
Add effect... 클릭
Unity > Color Grading 클릭
Tomemapping > Mode : check > None->ACES (ACES 톤 매핑 적용)
Tone > Post-exposure(EV) : check
Trackballs
Lift : 그림자와 같은 어두운 컬러에 영향
Gain : 밝은 하이라이트 컬러에 영향
Gamma : 중간 번위의 컬러에 영
10. Add the Bloom Effect
Add effect... 클릭
Unity > Bloom 클릭
All 클릭
Intensity : 2.5
Threshold : 0.75
11. Add the Ambient Occlusion Effect
Add effect... 클릭
Unity > Ambient Occlusion 클릭
All 클릭
Intensity : 0.5 (으스스한 그림자 생성됨)
Thickness Modifier : 3.5
12. Add the Vignette Effect
Add effect... 클릭
Unity > Vignette 클릭
All 클릭
Intensity : 0.5
Smoothness : 0.3
13. Add the Lens Distortion Effect
Add effect... 클릭
Unity > Lens Distortion 클릭
All 클릭
Intensity : 35
Scale : 1.1
14. Summary
[ 6.Ending the Game ]
1. Set up the UI
Create > UI> Image
Canvas 자동 생성된 것 확인
2D 버튼을 통해 2D 모드 활성화
2. Configure the Canvas
Canvas 이름 변경
Canvas => FaderCanvas
2D 버튼을 통해 2D 모드 활성화
EventSystem 삭제(옵션)
Canvas
RectTransform
Render Mode(Screen Space-Overlay/Camera, World Space)
Image > Source Image > Color (0,0,0,255)
검정색 을 꽉 채운 상태
3. Stretch the Image
씬 창(상단 아이콘 메뉴) >> Effects 버튼 클릭 >> Effects 비활성화
포스트 프로세싱 문제로 발생하는 사각형과 이미지의 오차 부분을 해결할 수 있음
4. Explore the Rect Transform Component
5. Configure the Rect Transform Component
Rect Transform
Anchors >> Min : 0, 0 / Max : 1, 1
Left/Top/Right/Bottom : 0
6. Add a Victory Image
Image 이름 변경 > ExitImageBackground
하위 Image UI > Image
Name : ExitImage
Image:Source Image : Won
Anchors >> Min : 0, 0 / Max : 1, 1
Left/Top/Right/Bottom : 0
늘어난 그림을 볼 수 있음
Image: Image Type > Preserve Aspect 체크
늘어나지 않는 최대한의 크기의 그림을 볼 수 있음
7. Add a Canvas Group Component
ExitImageBackground : Canvas Group 콤포넌트 추가
Canvas Group : Alpha : 0
그림이 사라진 것을 볼 수 있음
8. Create a GameEnding Trigger
Create Empty
Name : GameEnding
Position (18,1,1.5)
BoxCollider2D 추가
크기 변경(1,1,3.5)
9. Create a New Script
Create > C# Script
GameEnding.cs
10. Start the GameEnding Script
11. Add an Update Method
12. Write the if Statement Code Block
13. Set the Variables for your GameEnding Script
14. Summary
[ 7.Enemies, Part 1: Static Observers ]
1. Setting up the Gargoyle Prefab
Assets>Models : Gargoyle
Prefab으로 생성
2. Animate the Gargoyle
Assets > Animation > Animators
Create > Animator Controller : Gargoyle
Animator에서 Gargoyle 열기
Asset>Animation>Animation > Gargoyle@Idle > Idle.anim 드래그
Gargoyle의 Animator 컴퍼넌트에 Gargoyle(Controller) 삽입
Play Test
3. Add a Collider to the Gargoyle
Capsule Collider 추가
Center : (0,0.9, 0)
Radius : 0.3
Height : 1.8
4. Create a Trigger to Simulate the Gargoyle's Line of Sight
Gargoyle(GameObejct) > Create Empty
Name : PointOfView
Position (0, 1.4, 0.4) - Transform을 Local로
Rotaion(20,0,0)
Capsule Collider 추가
Is Trigger : 체크
Center (0,0, 0.95)
Radius : 0.7
Height : 2
Direction : Z-Axis
5. Write a Custom Observer Script
PointofView : Observer.cs 생성
6. Add a Class to Detect the Player's Character
7. Check the Enemy's Line of Sight is Clear
8. Revise your GameEnding Script
GaemeEnding.cs 수정
9. Create Two Ways To End The Level
10. Allow the Player to Restart the Level
11. Complete your Gargoyle Prefab
Gargoyle
Position ( -15.2, 0, 0.8)
Rotation(0,135,0)
Observer.cs:Player <--- JohnLemon
Observer.cs:GameEnding <--- GameEnding
FaderCanvas > ExitImageBackground 복제
Name변경 : CaughtImageBackground
ExitImage Name 변경 : CaughtImage
Image: Won --> Caught로 변경
GameEnging.cs:CaughtBackgroundImageCanvasGroup <-- CaughtImageBackground
12. Summary
[ 8.Enemies, Part 2: Dynamic Observers ]
1. Set Up the Ghost Prefab
Asset>Models>Characters:Ghost
Prefab으로 생성 후 열기
2. Animate the Ghost
Create > Animator Controller
Name : Ghost
Animator에서 Ghost 열기
Asset>Animation>Animation > Ghost@Walk > Walk.anim 드래그
Ghost의 Animator 컴퍼넌트에 Ghost(Controller) 삽입
3. Add a Collider to the Ghost
Capslue Collider 추가
Center : 0, 0.6, 0
Radius : 0.25
Height : 1.2
4. Add a Rigidbody Component to the Ghost GameObject
Rigidbody 추가
Is Kinematic : 체크
5. Make the Ghost an Observer
Gargoyle의 PointOfView 사용하기
6. Set up a Nav Mesh Agent Component
7. Create a New WaypointPatrol Script
8. Set the Destination of the Nav Mesh Agent
9. How Do Arrays Work?
10. Add Additional Destinations
11. Assign the Nav Mesh Agent Reference to the Ghost Prefab
12. Place Ghosts in your Scene
13. Create and Position the Ghost Waypoints
14. Place Gargoyles in your Scene
15. Clean Up the Hierarchy
16. Summary
[ 9.Audio ]
1. Audio
배경음
효과음
2. A Primer on Audio in Unity
Audio clip
Audio source
Audio Listener
3. What is Non-Diegetic Audio?
4. Create Audio Sources for your Game
Create Empty
Name : Ambient
Audio Source 컴포넌트 추가
AudioClip <--- Asset > Audio > SFXHouseAmbience
Spatial Blend : 2D (어디서나 같은 음량 제공)
Play On Awake : check
Loop : check
Volume : 0.5
5. Duplicate your Audio Source
Ambient 게임오브젝트를 복사해서 Escape, Caught 오브젝트 생성
Play On Awake : uncheck
Loop : uncheck
Voulume : 1
Escape AudioClip : SFXWin / CaughtAudioClip : SFXGameOver
6. Tidy up your Audio Sources
Create Empty
Name : Audio
Ambien, Escap, Caught 오브젝트를 Audio 게임오브젝트 하위로 이동
7. Return to your GameEnding script
GameEnding.cs
8. Update your GameEnding Script to Play Audio
9. Adjust your Method to use the New Variables
10. Make Sure the Audio Only Plays Once
GameEndiing.cs
ExitAudio <--Escape
CaughtAudio <--Caught
11. Add in Footsteps Audio
JohnLemon 오브젝트 > AudioSource 추가
AudioClip <-- Asset > Audio > SFXFootstepsLooping
Spatial Blend : 2D (어디서나 같은 음량 제공)
Play On Awake : check
Loop : check
12. Return to your PlayerMovement Script
PlayerMovemnet.cs 수정
13. Update your PlayerMovement script to play audio
14. Adjust your Method to use the New Variables
15. Move the Audio Listener to JohnLemon
Camera : Audio Listener 제거
JohnLemon : Audio Listener 추가
16. Update the JohnLemon Prefab
JohnLemon 프리팹 Update
17. Add an Audio Source to the Ghosts
Ghost : Audio Source 추가
AudioClip <--Asset > Audio > SFXGhostMove
Play On Awake : check
Loop : check
Volume : 0.4
Spatial Blend : 1
3D Sound Settings
Max Distance : 10
Volume Rolloff : Custom Rolloff
Stereo Pan : 0
3D Sound Settings : Spread : 180
18. Adjust the 3D Sound Settings features
19. Correct the Direction of the Ghost Sound Effect
20. Summary
[ 10.Build, Run, Distribute ]
1. Adjust Basic Player Settings
Edit > Project Settings : Player
Company Name
Product Name
멀티 플랫폼 지원
2. Adjust Resolution and Presentation Settings
Player
Resolution and Presentation
Fullscreen Mode
Run In Background
Standalone Player Options
Display Resolustion Dialog : 2019.3 버전 부터 삭제
3. Build Your Game
File > Build Settings
Scenes In Build
Bulid > 폴더 생성(실행 파일을 생성할 ...)
4. What does Unity produce?
5. Summary