- Home /
Enemies instantiate, in the wrong place, and don't show up in the Hierarchy
So I'm trying this again, I'm having an issue with a project I'm working on, where enemies are supposed to spawn at predetermined Spawn points using the transforms form empty gameObjects, up until 2 days ago this worked fine, but suddenly now my NPCs, and even some Level elements are instantiating in random places, and all of their transforms read that they are at location 0,0,0 despite the fact that they have no parent. as if this wasn't confusing enough, whenever I select the GameObjects they seem to not exist in the hierarchy, and when I've searched the hierarchy to see where these things are I find no trace.
this started with enemies not spawning where I told them to, and has suddenly moved on to half of the levels doing the same thing, I'm not sure what I could have changed.
unity version 2017.1.5f
If all you say its true, there are 2 options. You loaded some addon to unity that is corrupted, or Unity itself is corrupted.
TRy to reinstall Unity.
ok, thanks! I'll give this a try and see if that fixes the issue.
@tormentoarmagedoom You were 100% Correct, reinstalling unity seems to have fixed the issue, it seems that some crucial things were corrupted, Thanks!
Answer by GamitusLabs · Oct 15, 2018 at 04:03 PM
What I have found in my projects is when you instantiate objects their positions are relative to their parents transform. So, if they aren't instantiated parented 0,0,0 would be at the worlds origin, vs being centered on its parent (spawner, presumably) object. Can't really be sure of anything without some code (pseudo or actual) to reference.
Answer by TheEveknight · Oct 16, 2018 at 07:01 PM
right, the thing is, that they have no parent object, because i was testing to see if that was the problem in the first place, And i would post some code, but i'm away from that computer for most of the day today. The thing that confused me most was that they on't even show up in the object hierarchy at all, and i sifted through there pretty intensely.
i'm in the process of reinstalling unity 2017.1.5f too see if maybe something was indeed corrupted.
The issue is primarily that the objects are SUPPOSED to spawn at their respective spawn points as a child of the spawn point. they just arent, the weirdest thing that i actually noticed about this, is that they spawn in a pattern as though they would be spawning at the correct location, but at an incorrect location, i'm not sure how to explain this any way other than that
Both the enemies and the objectives are spawning as if the should be on the ship, but this is a LOOOOOONG way from where they should be
@tormentoarmagedoom You were 100% Correct, reinstalling unity seems to have fixed the issue, it seems that some crucial things were corrupted, Thanks!