after working in objective c for half a year, i think i should restart coding with unity again. just.. keep studying.
i decided to restart with unity tutorial, in case i missed something fundamental before or unity add something new in unity 5. the first one will be survival shooter:
things I learned:
1.Slider to control size of thumbnail
2.Layout 2 by 3
3.The built-in plane has 121 vertices and 200 triangles, and a quad has 4 vertices and 2 triangles. Plane faced pos y by default while quad faced neg z. plane is 10*10 by quad is 1*1. they are both primitive
4.Light: dynamic, baked
Ambient light(set to black to get a full control of light) emission light(baked light)
Cookie for light, a texture for light partern, cube for point light
Render mode:not important(Vertex), important(pixel,support shadow, cookie, other fancy stuff
5.use any state for die. So you can go die from any state
6.Input.GetAxisRaw will only get 0,-1, or 1
7.use LayerMask.getMask to get a mask of layer and can be used in rayCasting
8.int jumpHash = Animator.StringToHash(“BaseLayer.Jump”)
animatorStateInfo info = anim.GetCurrentAnimatorStateInfo(0)
If(info.nameHash == jumpHash)..
This callback will be invoked at each frame after the state machines and the animations have been evaluated, but beforeOnAnimatorIK.
10.curve in animation transition, show which food is more stable
12.animationView can be used to create some simple animations(transform, scale..) and can be treated as normal animation
13.camera’s update mode should be the same as player’s
14.canvas is huge because each pixel is size of a unit
15.in layers, can select the layer you only want to see
16.when set the preset of rect transform, use alt and shift to set position and pivot at the same time.
17.Add canvas group to parent canvas and set teractable to no, then the whole canvas will be not interactable.
18.damageImage.color = Color.Lerp (damageImage.color, Color.clear, flashSpeed * Time.deltaTime); when Speed * Time.deltaTime = 0.5, then every frame, the color will fade half
19.time.deltaTime will return how many seconds has left since last frame
20.when you want to move a rigidbody and don’t want it to be affect others so no need to calculate(like something is dead and you set isTrigger = true), set rigid body isKinematic = true too.
21..setActive is for gameObject, .enable is for component
22.rect transform position is related to the pivot
23.lineRenderer, should set the position of points on it
24………TAKE CARE WHEN YOU DELETE SOMETHING. Pay attention to what are you deleting. A file or the folder. I accidentally delete the whole prefab file and can’t undo it.. But you can find it in recycle bin 🙂
25.animator override controller, awesome. Can be used when two animator controller has the same structure but different animation clips. For example, two enemies that moves and attacks in the same way but has different rig and animation.
26.alwasy reset object to 0 when you create one. Save times to get confused and debug later..
27.when want to set an empty object, like a spawn point, can add a tag for it in inspector’s top left corner
28.in UI hiarchy, the thing on the top will be draw first so will be in the bottom..weird..
29.can add shadow to text
30.animation can add on any object to control everything, scale,transform, color on that object and on the children of that object
31.overflow in text, when text is larger than rect, still show it.
32.unity5 support mixer to make audio separate and scripable.
33.when back nav mesh, can use layer to create mesh with different cost, like mud
34.for navMesh obstacle, there are two ways to do that. First is to turn on the carve, which will update the whole navmesh and path finder knows the big picture and give a correct nav, can be used for blocks of items. Another is not carve, the way to avoid is like collision detection.
35.right click on param in inspector for mixer can expose it.
36.in mixer, can send one to multiple receivers, or send multiple to one receiver.
37.changes in mixer in play mode will be save when you back
38.volume is the basic param mixer has.
39.audio is so hard.. It’s a totally new field that I can’t understand..
40.hit.collider.CompareTag (“Enemy”) check if tag is enemy
41.navMeshAgent.remainingDistance check if is time to stop
everything about survival shooter is done.