สร้างโลกของคุณเอง
การจัดเก็บข้อมูล
PlayerPrefs - การบันทึกข้อมูลลงบนอุปกรณ์
1นาที
ให้ความสามารถในการบันทึกผู้เล่นลงในอุปกรณ์ที่พวกเขากำลังเชื่อมต่ออยู่ ข้อมูลจะไม่ถูกเก็บรักษาหากคุณลบแอปหรือเปลี่ยนอุปกรณ์ รองรับการใช้งานในลักษณะเดียวกับ playerprefs ใน unity และความจุในการจัดเก็บจำกัดอยู่ที่ 10kb ▼ ตัวอย่างโค้ดสำหรับตรวจสอบจำนวนการเล่นโดยใช้ฟังก์ชัน save & load import { zepetoscriptbehaviour } from 'zepeto script'; import { playerprefs } from 'unityengine'; export default class clientsaveload extends zepetoscriptbehaviour { private playcntkey string = 'keyname'; start() { if (playerprefs haskey(this playcntkey)) { playerprefs setint(this playcntkey, playerprefs getint(this playcntkey) + 1); console log(`playcnt ${ playerprefs getint(this playcntkey) }`); } else { playerprefs setint(this playcntkey, 1); console log('playcnt 1'); } } } 📘 ดูข้อมูล playerprefs ของ unity https //docs unity3d com/scriptreference/playerprefs html https //docs unity3d com/scriptreference/playerprefs html