[내일 배움 캠프 Unity 4기] W9D1 06.10 TIL

김용준·2024년 6월 11일
0

내일배움캠프

목록 보기
32/47
post-thumbnail

Goals

  • Implement interaction; drink water at the river
  • Dynamic creation; coroutine

Interaction

For the condition of moisture, we have to implement the drinking interaction. In the project, there are river that has unlimited source of water. Utilizing that source, player can fill the moisture by interacting with the river. While the development, the bug of iteminformation was occur. The hierachy can be written as Water - Ground - Player. If the player stand on the land, the interaction of water should not be done. However, the raycast gave us the possible to interact water. The problem was solved with below codes. By adding the ground layer to the interact mask, the ray has blocked at the ground.

Dynamic creation; coroutine

In the project, the item slots were generated by the dynamic process. However, the component attached on item slot doesn't initialized because the mother gameobject deactivated faster than the initialization. In order to solve the problem, we asked method to the tutor.
One of charactericstic on reply was the utilizing corouting to the Start function. Since the 'Start' method is invoked by Unity, I didn't give an idea to modify the method. And other on reply is the usage of canvas group. In the canvas group component, there's an variable to control transparency of canvas. Utilizing coroutine on Start, we also applied canvas group; like below code snippet.

profile
꿈이큰개발자지망생

0개의 댓글