- Home /
huge istantiating gives me problems (collider does not exist any longer)
ok I've propably got millions if not miliards of istantiated objects (cubes)
no I cannot shrink it any less to get less objects
after cirtain time for every istantiated hallway (3*4 floor + 2*4 wall) batch my FPS drops to 0 for a sec or 2 and yes this is pretty much normal
if I go forward for longer my istantiated objects loose collider and I just don't get it why
and after that cirtain point all new istantiated hallways loose collider?
is that normal?
and no those that are left behind MUST not be disabled and reused as char can go back and must see them right there
and yes each hallway is in 1 collection and I made rendering only hallways 50m away from me all else get rendering disabled (not the collections but every cube separately)
so after an hour or 3 I'f found I fall through floor or to through wall of all new hallways
You do realize that had you only allocated 1 billion integers of 32 bit size, you'd consume 3.72 GigaBytes of RA$$anonymous$$ right?
So instantiating 1 billion of even just an empty GameObject (which is the $$anonymous$$imum for a prefab...) would mean:
"no I cannot shrink it any less to get less objects" - is not a valid answer for your solution.
You have to confine yourself to some kind of limits.
am yes I do
propably more as all objects have a script so floors know where to create new floors , ... walls
and am why does my taks manager say I have only 2.3GB ram used not even 50%
so if I do understand you correctly this is pretty much normal behaviour?
but why does it create new objects so I can see them and it renderes them
I'm having trouble understanding what is the issue you are talking about - could you try and rephrase your issue?
I doubt you are actually instantiating 1 billion (1,000,000,000) prefabs. You'd probably crash unity or at least make it unplayable since what ever won't fit into your free RA$$anonymous$$ would go into the VRA$$anonymous$$ (slow hard drive memory).
actually my issue was why do new istantiated objects get no colliders
but I'm going to work with the answer that was provided even tho this answer was not my question but does help my problem
Answer by sparkzbarca · Mar 21, 2013 at 10:37 AM
just to bother taking an actual stab at this why not.
You basically do like minecraft in some ways.
You just store the locations of where everything would be in a room but you don't make it.
You make it as needed and DONT DESTROY MOVE.
You've got a limited number of pieces you just create 999 of each piece you then spawn them all off in a tiny little corner during loading you move them into position you remove a layer of blocks behind you and toss them in the corner you take pieces from the corner and build a new layer in front.
Viola you got millions of pieces made by thousands of objects.
hmmm this could work :)
hmmmm I have to make some new stuff than as I remove cirtain walls with rays I'll propably have to make around 16 hallway prefab than...
thanks for idea :)
Your answer
Follow this Question
Related Questions
Can't set the random position for an Instance. 1 Answer
How can I add the OnTriggerEnter function to all game objects that I instantiate? 1 Answer
Instantiated GuiTextures not showing 1 Answer
How to destroy an instantiated prefab object and keep instantiating it 1 Answer
how to prevent an gameobject of instantiating if theres an collider where it is supposed to collide 1 Answer