"Projectiles" GameObject sometimes spawning within "Defenders" GameObject... Problem?

Hi all,

just a very minor questions. I usually tend to copy myself script I find usefull for my future development into a cheat sheet.

I noticed a minor glitch after following Ben 1:1 in this session.

When I now place a single defender who’s shooting frequency is not so high, he “spawns” his projectile gameobject (the empty one, that is just the parent for the “missiles”) inside his own parent object “defenders”, so it looks like this :

Defenders
-----gnome
-----projectiles
----------axe

When I spawn more defenders, so that there are more “missiles” on runtime, the projectiles gameobject is positioned at the top hierarchy.

Is this something to be worried about and could relate to errors later, or can I just see this as a “minor sorting glich”, since the projectiles are temporary anyway.

Thanks for answering :slight_smile: If it’s safe, I can copy the script into my cheat sheet.

B/R
Michael

Hi Michael,

I’m not certain which specific lecture you are on, so this may be something which is changed in a later video, however, here is a screenshot from the structure once this section of the course is completed.

image

In this screenshot, a cactus has been placed in the game’s playspace and a lizard has just spawned on the same row. A single courgette projectile has been fired by the cactus.

As you can see, there is a parent for the Defenders and a parent for the Projectiles.

Once things get going;

image

There are now more defenders, more attackers and at the time of the screenshot, two courgette projectiles in play.

Hope this helps :slight_smile:

Hi Rob,

thanks for your answer. I think I found the problem, it was sitting before the screen :smiley:

It was just misinterpreting things…When I instantiate the defender, the “projectile” is created as intented, but since it’s empty before the first projectile comes, it doesn’t have the little triangle symbol in front… And by looking at it, I thought it would be child of defender because the word projectile was sitting right under it (and I had defender opened)…

I need to look more closely in the future.

Thanks and B/R
Michael

1 Like

Hi Michael,

I think I found the problem, it was sitting before the screen :smiley:

Lol - I’m sure that isn’t the case :slight_smile:

When I instantiate the defender, the “projectile” is created as intented, but since it’s empty before the first projectile comes, it doesn’t have the little triangle symbol in front… And by looking at it, I thought it would be child of defender because the word projectile was sitting right under it (and I had defender opened)

Aha, well I’m glad you’ve resolved it - well done :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms