提问人:Chí Bảo Nguyễn 提问时间:12/23/2022 更新时间:12/23/2022 访问量:55
不知道为什么用“this”来检查
Do not know why using "this" for checking
问:
我创建了一个名为 包含场景中所有游戏对象的数组。我还创建了 foreach 循环来检查是否附加了 .我正在关注这本书,但它没有清楚地解释为什么我们需要.Zombies
Zombies
ZombieState.cs
zState==this
using UnityEngine;
public class ZombieState : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
GameObject[] Zombies = (GameObject[])GameObject.FindObjectsOfType(typeof(GameObject));
foreach (GameObject go in Zombies)
{
ZombieState zState = go.GetComponent<ZombieState>();
if (zState == null || zState == this)
{
continue;
}
}
}
}
答: 暂无答案
评论
this
zState
ZombieState
zState
ZombieState
Singleton
Zombie
Zombie