Essentials of programming in Unity

 

Summary

วันนี้เราจะมาเรียนรู้ Essentials of programming หรือก็คือสิ่งที่ควรนี้ในการเขียนโค๊ดใน unity C# นั่นเอง

Project Objective

 - Explain the role of the Integrated Development Environment (IDE) in Unity  

 - Open the IDE from the Unity Editor  

 - Create a new script component  

 - Understand the purpose of the default code generated within a newly created C# script  

 - Print a message to the Unity Editor console using a simple script 

 - Change a GameObject using a simple script  

 - Explain the relationship between scripts and components 

Get started with scripts

IDEs คืออะไร?

    IDEs ย่อมาจาก Integrated Development Environments คือโปรแกรมที่ช่วยให้นักพัฒนาซอฟต์แวร์สามารถเขียน แก้ไข และทดสอบโค้ดได้อย่างรวดเร็วและสะดวกขึ้น เช่น Visual studio, Visual studio code, Xcode เป็นต้น 

    IDE มักถูกใช้ในการพัฒนาโปรแกรม แอปพลิเคชัน และเว็บไซต์ เป็นต้น โดย IDE จะมีความหลากหลายตามภาษาโปรแกรมต่างๆ เช่น Java, Python, C++, และ HTML/CSS/JavaScript ซึ่งนักพัฒนาสามารถเลือกใช้ IDE ที่ตรงกับภาษาและการพัฒนาของพวกเขา

มาลองสร้าง Scripts กันเถอะ!

 - เลือก GameObject ที่เราต้องการและไป Add component ที่ Inspector จากนั้นหาคำว่า New script

 - ตั้งชื่อ Scripts ว่า Hello world


 - ถ้าสร้าง Scripts โดยการ Add component ตัวไฟล์ scripts จะไปโผล่อยู่หน้า Assets และลากไปเก็บที่โฟลเดอร์ Script เพื่อความสดวก แต่เราสามารถสร้าง Script ได้ในโฟลเดอร์ Scripts ได้เลยและลาก Scripts ที่ต้องการเข้าไปใน Inspector

 - เปิด Script ด้วย IDE ที่เราต้องการโดยเราจะใช้ IDE คือ Visual Studio แต่หากใครต้องการใช้ Visual Studio Code ก็ให้โหลด mono และ extension สำหรับ C# มาใช้ได้

 














game blog w16-1

  Summary   Centent ใน week ที่ 16-1 มีดังนี้   - Human player turn to ghost when died    - Ghost bot (path finding with project A*)   Human...