using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class xuhaitao : MonoBehaviour
{
public static xuhaitao instance;
public List<Person> jihe = new List<Person>();
public Dictionary<string ,Person> dic = new Dictionary<string, Person>();
private void Awake()
{
instance = this;
Person p01 = new Person("xuhaitao",38);
jihe.Add(p01);
dic.Add(p01.name, p01);
print(jihe[0] == p01); // true
print(dic["xuhaitao"] == p01); // true
p01.age = 99;
print(jihe[0].age); // 99
print(dic["xuhaitao"].age); // 99
}
}
public class Person
{
public string name;
public int age;
public Person(string namee,int agee)
{
name = namee;
age = agee;
}
}
FR:徐海涛(hunk Xu)
QQ技术交流群:386476712