#Condense multiple realtime placed prefabs into a single one

1 messages · Page 1 of 1 (latest)

tacit garden
#

I am generating a map with small tile-like prefabs, and therefore, in some cases I place hundreds, and in some tens of thousands of GameObjects...
Assuming I compress all my prefabs into a single GameObject each(with something like ProBuilder), it would still be too much, is there a way to turn all my Realtime placed Prefabs into one single big GameObject?

#

and that is a TINY map

tacit garden
#

After merging all the GameObjects in each prefab into a single object + removing the floor from each tile to place a big floor under the whole thing(only works in prototype because in a real map you'd prob have variations in the floor but we'll see), redueced batches by half

However if I can somehow merge all 200 tiles (and therefore gameobjects) on screen into a single one I imagine it'd save much more??
(and again 200 is a tiny example, usually there'd be much more)

tacit garden
#

This is a bigger map, Idk if I'd even make maps as big as that(tho I've made much bigger for the funny) but the stats aren't promising
(Last one was 20x10, this one is 60x30)

vague nacelle
#

@tacit garden how are you measuring performance?

tacit garden
#

and I'm pretty sure it's best to decrease them

vague nacelle
#

So premature optimization...

#

Not even optimization you're just reducing a number

tacit garden
#

Well the larest map I tried to make was a 400x30

#

oh wait no that was without placing GameObjects

#

the laregest game object one was the funny one, 200x100

#

that's 20k Tiles, which (before merging), was approx 80k game objects in a scene

#

it doesn't sound ideal at all lol

#

I need to measure how much time was Unity starting the game and how much was the generation and how much was instantiation for a better idea I suppose

vague nacelle
tacit garden
#

but there's so much going on I can't even find my script in there nor a search function

#

Imma go look at how they work lol

vague nacelle
#

turn on deep profile

tacit garden
#

oooh

#

where is it?

vague nacelle
#

and use hierarchy mode or something like that

#

but I would continue working on features rather than optimizing

#

this would just be for your own interest

tacit garden
#

now it takes way less(it was last night)

#

but it made me wake up with the desire to fix that lol

#

prob better moving on

#

tho good stuff to know

tacit garden
vague nacelle
#

it's a button kind of at the top

vague nacelle
#

this impacts dev

tacit garden
#

way more than earlier that day or today

vague nacelle
#

What changes were made

tacit garden
#

Well... now I reduced the game objects in each prefab to one each, but I imagine just my PC getting some rest llol

vague nacelle
#

You mean there's a cost for generating the scene? And you suspect that this is due to the number of game objects?

tacit garden
#

maybe something I had on was memory leaking and caught a lot of RAM

tacit garden
#

messing with the prefabs was easy enough to not mind doing anyways

vague nacelle
#

Ok

#

For future reference, you'll probably want to do some kind of mesh generation or merging to reduce the number of tris and verts in your scene

tacit garden
#

yupp I imagine I would

#

No idea how that works yet(pretty sure I've done that once a few years ago on smth not sure) but when the time comes i'll take care of it

#

I found the deep profile button too, so thank you