iT邦幫忙

2021 iThome 鐵人賽

DAY 14
0
Software Development

從零開始了解Unity或Unreal Engine應用於VR軟體開發系列 第 14

Day 14. Tutorial: Create a scene flow - 10. Challenge Answer

  • 分享至 

  • xImage
  •  

如果你也有跟著教程做的話,第10節有個練習,可以來跟我交流一下答案,我也不知道我的寫法是不是好的,但反正他work了。

 
 
 

10.Challenge: Set up the transition back to the Menu scene

Now users can get to the Main scene and exit the application from the starting menu, but at the moment they can’t get back to that menu from the Main scene.
We’ve created a Back to menu button in the Main scene, but you’ll need to get it working yourself.

Remember:

  • You can find the GameObject for the button in the Canvas GameObject.
  • The Canvas GameObject has the UI Main Scene (Script) component attached — this handles the UI in the Main scene.
  • You can review the process you followed in Configure the Start button if you get stuck.
  • Test your changes in Play mode to make sure they work properly.

 
 
 
Yes
 
 

我在Main場景的Canvas的C# Component(UIMainScene.cs) 加入了下面的BackMenu()

# UIMainScene.cs

private void Update()
{
    ...
}

public void BackMenu()
{
    SceneManager.LoadScene(0);
}

並把Canvas裡被命名為Exit的方框圖形的On Click()處,讓他連接上Canvas的C#檔案,並選擇UIMainScene.BackMenu()作為On Click()時觸發的Method。

 
 
這樣就OK了~

參考:
https://learn.unity.com/tutorial/create-a-scene-flow?uv=2020.3&missionId=5f751af7edbc2a0022cdbbb6#60b73f73edbc2a5532d132d5


上一篇
Day 13. 是時候來規劃個專案了,先來個小調查
下一篇
Day 15. 來了解Data Persistence in Unity
系列文
從零開始了解Unity或Unreal Engine應用於VR軟體開發31
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言