(English) DontDestroyOnLoad by kisda
31
Jul0
Jul0
static void DontDestroyOnLoad(Object target);
Description
ทำให้เป้าหมายของ Game Object ที่ไม่ถูกทำลายโดยอัตโนมัติเมื่อโหลดฉากใหม่
จากการทดลอง เวลาเรา load Screen ใหม่แล้วเราต้องการเก็บ ข้อมูลบางอย่างไว้ หรือ Game Manager ก็ควรใช้คำสังนี้ครับ
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
void Awake() {
DontDestroyOnLoad(transform.gameObject);
}
}
Enjoy this article?
Consider subscribing to our RSS feed!
ไม่มีความเห็น
ยังไม่มีความเห็น