#Memory Spike Issue

1 messages · Page 1 of 1 (latest)

strange ivy
#

I'm having troubles with this script causing a big spike in memory whenever it begins to run and I don't know the most efficient way to fix it.

crystal quartz
#

!code

old stumpBOT
strange ivy
#

i'm sure it has something to do with me instantiating gameobjects but i don't know what else to do to spawn in my players and the stage. for context, its a platform fighting game, something like Super Smash Bros, and i need the characters and the stage they play on to spawn in.

strange ivy
crystal quartz
#

yes

#

(large code blocks)

strange ivy
ionic kayak
#

THere's a ton of extraneous and repetitive code in here that can be simplified a lot

#

As for the spike in memory... is it causing any kind of problem?

#

Is there a performance issue?

#

What made you worried about it?

#

But yeah you're allocating a good number of unecessary strings here. You're doing a ton of extraneous GetComponent calls. A ton of extraneous .transform property calls.

How much memory is a "big spike" exactly?

strange ivy
# ionic kayak Is there a performance issue?

yea i tried testing it on a couple of my other friends computers and when switching to the scene with that script in the build, it would freeze and say "not responding" for like 30 seconds at best and 3 mins at worst

#

im not really sure what the best way to instantiate these prefabs are

#

and when i tested it on my pc, it averaged using like 500ish mb in memory and then would spike to 2-4 thousand mb

#

its SO BAD

ionic kayak
#

why aren't you worried about the CPU

#

Either way yeah it's definite;y time to bring in the profiler

strange ivy
#

im sorry im not very knowledgable with computers

#

how do i use the profiler?

crystal quartz
strange ivy
#

okay

ionic kayak
#

focus more on the "my game is freezing for a long time" part