-
Notifications
You must be signed in to change notification settings - Fork 0
/
CountBlobs.cs
30 lines (27 loc) · 972 Bytes
/
CountBlobs.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using UnityEngine;
public class CountAllBlobs : MonoBehaviour
{
void Start()
{
// Conta todos os objetos com a tag "Blob"
GameObject[] blobsWithTag = GameObject.FindGameObjectsWithTag("Blob");
foreach (GameObject blob in blobsWithTag)
{
if (blob.name.Contains("blobPrefab"))
{
// Acessa o componente BlobPersonality do blob
BlobPersonality personality = blob.GetComponent<BlobPersonality>();
// Verifica se o blob tem o componente BlobPersonality
if (personality != null)
{
// Imprime o nome armazenado no script BlobPersonality
Debug.Log($"Nome do Blob: {personality.blobName}");
}
else
{
Debug.Log($"BlobPersonality não encontrado no objeto {blob.name}");
}
}
}
}
}