เริ่มกันเลยครับ
1. ให้ทำการสร้าง Cube และ ทำการ Assign Texture ให้กับ Object
2. จากนั้นทำการเปลี่ยน Material ให้เป็น Transparent / Diffuse
using UnityEngine;
using System.Collections;
public class TransparentController : MonoBehaviour
{
private Color currentColor = Color.white;
// Get Currrent Color Material
void Start()
{
currentColor = renderer.material.color;
}
// Set Alpha to 0.5f
void OnMouseOver()
{
renderer.material.color = new Color(currentColor.r, currentColor.g, currentColor.b, 0.5f);
}
// Set Alpha back to 1.0f
void OnMouseExit()
{
renderer.material.color = new Color(currentColor.r, currentColor.g, currentColor.b, 1.0f);
}
}
เท่านี้ก็สามารถนำไปประยุกต์ใช้งานอื่นๆ ได้แล้วครับ
ปล. มีอะไรแนะนำได้นะครับ
ช่วงนี้ไม่ค่อยมีเวลาหาข้อมูลหรือทำโปรเจ็คใหม่ๆ (ยังจัดเวลาไม่ลงตัว เลยได้แต่โพสบทความสั้นๆ) ต้องอภัยด้วยนะครับ