プログラムは次のとおりです。
[SerializeField] ARPointCloudManager mArPointCloudManager;
private int numPointsUpdated = 0;
// Start is called before the first frame update
void Start()
{
UpdateTextPlanes();
mArPointCloudManager.pointCloudsChanged += onPointCloudsChanged;
}
// Update is called once per frame
void Update()
{
UpdateTextPlanes();
}
void onPointCloudsChanged(ARPointCloudChangedEventArgs args)
{
foreach (var pointCloudUpdated in args.updated)
{
numPointsUpdated += 1;
}
}
private void UpdateTextPlanes()
{
PlaneText.SetText(" Point Clouds Updated = " + numPointsUpdated);
}
プライベート int 変数の値はゼロのままで、なぜそれが起こっているのかわかりません。変数を静的にして、他のすべての前にクラスの一番上に配置しようとしましたが、違いはありませんでした。私はたくさん検索しましたが、解決策も説明も見つかりません。私は初心者です。