调用组件上的方法
- 1)必须的有这个组件才能调用,没有就会报错,而且重复的也只能调用其中一个组件go.GetComponent().BeCalled();
- 没有这个组件也不会报错,重复的组件会全部调用。go.SendMessage(“BeCalled”);
- 该组件自身和该组件下面的所有子组件中,只要有BeCalled的都可以找到,go.BroadcastMessage(“BeCalled”);
- 该组件自身和该组件上面的父组件与父组件的兄弟组件
go.SendMessageUpwards(“Becalled”);
二:PlayerPrefs
可以保存3种类型的数据,浮点,字符串、整型数据
先保存再加载打印
保存json数据的方法
PlayerPrefs("",json)
unity文档
https://docs.unity3d.com/cn/2019.4/ScriptReference/PlayerPrefs.html