I have an issue which I can’t seem to solve in regards to prefabs knowing when other prefabs have been deleted.
As an example I have a game manager that spawns 100 cubes. Each cube has a script attached that spawns a sphere above it when it spawns. Both cubes and spheres are prefabs. So far so good, we have 100 cubes with 100 sphere above them.
Now each sphere has a script attached that destroys it when it is clicked on. What I would like is for each of the cubes to then know that the sphere above it has been destroyed and spawn another one.
The trouble is that I can’t seem to send a message to the cube below to let it know the sphere above had been destroyed.
I’ve tried the following:
- Childing the sphere - can;t as both are prefabs and it gives an error
- Actually getting the cube to shoot an invisible ball to check if the sphere is there - memory issues
- numbering prefabs - but this got messy and the numbers add up quickly to over millions - currently all instantiated prefabs have the (Clone) bracket next to them.
Using the latest 5.3.4 C#
I simply need to let the cube know when the sphere has been destroyed.
Thanks for your help.