Page 1
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 1/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
Getting Start with Unity3DTran Thien Khiem
8;<84<84 = >".1?)@ 8
A,.0).0
! Introduce Unity3D ! Unity3D Vocabulary ! Game Editor ! Basic Scripting ! Basic Physics
8;<84<84 = >".1?)@ ;
Page 2
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 2/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( ;
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
Introduce Unity3D
8;<84<84 = >".1?)@ 4
B.0+,C@%) 2.$0345
! Cross-platform Game Engine
8;<84<84 = >".1?)@ D
Page 3
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 3/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 4
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
B.0+,C@%) 2.$0345
! Support both 2D & 3D
8;<84<84 = >".1?)@ E
B.0+,C@%) 2.$0345
! Integrated Development Environment (IDE)
8;<84<84 = >".1?)@ F
Page 4
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 4/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( D
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
B.0+,C@%) 2.$0345
! Free version included
8;<84<84 = >".1?)@ G
Unity3D Vocabulary
8;<84<84 = >".1?)@ H
Page 5
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 5/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( E
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
2.$0345 I,%">@J"+3
! Assets: – Graphics, Animations, models, Sound files… that build
the project ! Scenes:
– Individual levels, areas of Game content ! Game Object: object in game
8;<84<84 = >".1?)@ K
2.$0345 I,%">@J"+3
8;<84<84 = >".1?)@ 8L
Page 6
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 6/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( F
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
2.$0345 I,%">@J"+3
! Component: attach to Game Object to controlthe behavior of the Object – Renderer component – Physics component – Script component
! Prefabs: reusable Game Object store as assets.
8;<84<84 = >".1?)@ 88
2.$0345 B.0)+M"%)
1 2
3 4 5
8;<84<84 = >".1?)@ 8;
Page 7
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 7/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( G
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
2.$0345 B.0)+M"%)
! [1] Scene View: interactive with all Game Objects ! [2] Game View: Representative of your final,
published game ! [3] Hierarchy: Contains every Object in yourGame ! [4] Project Browser: Access and manage
assets ! [5] Inspector: Display detailed information of
selected Object. 8;<84<84 = >".1?)@ 84
N,+OP,/
! Import Assets ! Create Scenes ! Test your game ! Publish
8;<84<84 = >".1?)@ 8D
Page 8
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 8/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( H
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
*+,Q)%0 !+,/#)+#
! Assets import: – Right click -> Import new Assets…
! Keep your folders organized: – Scenes – Prefabs – Sprites – Animations – Sounds
8;<84<84 = >".1?)@ 8E
R##)0# S TU+$0)#
! Import 2D Sprite: – Import image – In Inspector View, select:
• Texture type: Sprite• Sprite Mode: Single or Multiple
! Demo
8;<84<84 = >".1?)@ 8F
Page 9
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 9/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( K
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
R##)0# S R.$("?,.
! Animation: – Frame based animation
– Tween animation ! Demo 8;<84<84 = >".1?)@ 8G
T%).) V$)/
! Create Game Object: – Drag assets to the scene view
8;<84<84 = >".1?)@ 8H
Page 10
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 10/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8L
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
T%).) V$)/
! Create Game Object: – Drag assets to the scene view
! Use to: – Pan (Q) – Move (W) – Rotate (E) – Scale (R)
! Demo 8;<84<84 = >".1?)@ 8K
T%).) V$)/
! Unity3D coordinate system:
8;<84<84 = >".1?)@ ;L
Page 11
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 11/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 88
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
*+)M">
! Using Prefab: – Simply drag an Object back to Project Browser – You can re-use this Object like an Asset – If you edit one instance of a Prefab, you can apply the
change to all instances
8;<84<84 = >".1?)@ ;8
T%+$U?.-
! We can attach a Script Component to change thebehavior of the Object – Create a script in Project Browser – Then drag and drop to the Object
8;<84<84 = >".1?)@ ;;
Page 12
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 12/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8;
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
T%+$U?.-
8;<84<84 = >".1?)@ ;4
T%+$U?.-
! Script Life time:
8;<84<84 = >".1?)@ ;D
R/"O)WX
T0"+0WX
2UC"0)WX
Y$Z)C2UC"0)WX
Page 13
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 13/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 84
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
T%+$U?.-
! Access to container GameObject – gameObject.
! Translate, Rotate Object: – gameObject.transform.position
! Destroy Object: – Destroy(GameObject);
8;<84<84 = >".1?)@ ;E
T%+$U?.-
! Input Manager: – GetKey: use directly with keyCode
• Input.GetKeyDown(keyCode): pressed • Input.GetKey(keyCode): held • Input.GetKeyUp(keyCode): released
– GetButton: Assign a button name • Input.GetButtonDown(buttonName): pressed • Input.GetButton(buttonName): held • Input.GetButtonUp(buttonName): released
8;<84<84 = >".1?)@ ;F
Page 14
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 14/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8D
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
T%+$U?.-
! Input Manager: – OnMouseDown(): call when user click on the object
8;<84<84 = >".1?)@ ;G
T%+$U?.-
! Instantiate – Create an instant of a prefab at run time – Instantiate(prefab, position, rotation)
8;<84<84 = >".1?)@ ;H
Page 15
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 15/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8E
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
Basic Physics
8;<84<84 = >".1?)@ ;K
A,JJ$C)+#
! Geometries to detect collision ! Collision Event:
– OnCollisionEnter() – OnCollisionStay() – OnCollisionExit()
8;<84<84 = >".1?)@ 4L
Page 16
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 16/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8F
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
A,JJ$C)+# R# 6+$--)+
! Trigger won’t interact with other physics objects ! Trigger Event:
– OnTriggerEnter() – OnTriggerStay() – OnTriggerExit()
8;<84<84 = >".1?)@ 48
[$-$C !,C$)#
! Rigid Bodies ! Add Force ! Add Torque
8;<84<84 = >".1?)@ 4;
Page 17
7/22/2019 Introduce to Unity.pptx
http://slidepdf.com/reader/full/introduce-to-unitypptx 17/17
!"#$% '"() *+,-+"(($.- /$01 2.$0345
6+". 61$). 71$)( 8G
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
: 999999999999999999999999999999999999999999999999::
Notes: 999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999::
999999999999999999999999999999999999999999999999:::999999999999999999999999999999999999999999999999::
!"#$% '()
8;<84<84 = >".1?)@ 44