#Right after spawning the enemy put this

1 messages · Page 1 of 1 (latest)

wide canyon
#

'GameObject' does not contain a definition for 'location' and no accessible extension method 'location' accepting a first argument of type 'GameObject' could be found (are you missing a using directive or an assembly reference?)

livid olive
#

Sorry, .position

#

I'm juggling a lot of conversations

wide canyon
#

hey its fine! i actually tried .position as well, but it gives the same error, but for position rather than location

livid olive
#

enemy.transform.position

#

It's the spawnLocation object that's a transform

wide canyon
#

Spawning an enemy at the position of Platform Spawn Checker (UnityEngine.Transform), which is (44.12, 2.54, 0.00). Enemy is at (20.23, 2.23, 0.00)

#

its the platform spawn checker, that is the transform, its where i want the enemies to spawn, so theyre essentially always offscreen, to the right of the player

#

you can see there that theyre not spawning at the current transform of the platform spawn checker

livid olive
wide canyon
#

yes actually, on thier spawn, they should always be to the right of the player

#

which turns out isnt happening either

livid olive
wide canyon
#

because the player object can move far past where theyre spawning

livid olive
#

That value does look like it'd reasonably match up with the location it's getting

wide canyon
#

im gonna speculate here but are all the new prefab enemies that are spawning, not finding the player maybe and thus theyre just spawning all around x19

livid olive
wide canyon
#

in the prefab

livid olive
#

So they're spawning exactly where you tell them to

wide canyon
#

right so i need to set them to spawn relative to the game object (?) player if im understanding this correctly

livid olive
#

Yes. You are already finding the object in the scene in start, use that instead of having a different variable that holds the player's prefab

wide canyon
#

ok cool, i've got this working now, thanks. what i've done is removed the "find player gameobject" line from the individual enemy script, as it was already finding the player script there anyway, and using the transform of the script rather than the play gameobject. once again, thanks a million.

fierce surge
#

u still using unity?