1.首先创建一个和xml对应的类
using UnityEngine;
using System.Collections;
public class GameData{
public int playerIntegration;
public int computerOneIntegration;
public int computerTwoIntegration;
}
2.然后需要一个xml类,放在工程的根目录下(没有的话,可以通过后面写的方式新建一个,将FileMode.Open改为FileMode.OpenOrCreat)
<?xml version="1.0" encoding="utf-8"?>
<GameData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<playerIntegration>0</playerIntegration>
<computerOneIntegration>0</computerOneIntegration>
<computerTwoIntegration>0</computerTwoIntegration>
</GameData>
</pre></p><p></p><div>3. 然后开始读写操作</div><div> 需要引用下面几个空间</div><div> </div>