#Infinite spawn issue
1 messages · Page 1 of 1 (latest)
I mean it sounds like you already identified the issue
you are spawning infinite rooms
stop doing that
You're not adding to Rooms when you spawn a room
private void Start()
{
Logic = GameObject.Find("Logic");
Logic.GetComponent<RoomHolder>().Rooms.Add(this.gameObject);
}
where are you setting isTriggered to false?
or is there a SeedHolder on each room?
As soon as you hit a rooms collider its considered triggered so we dont need to revert
I wonder if OnTriggerEnter runs the same frame you instantiate an object
I have never thought about that.
How would we even account for that
If that's true, then you'd get infinite rooms, since none would add to Rooms until the next frame
OnTriggerEnter doesn't run until the physics sim
ah, good point.
I would attach a debugger to find out where it's stuck.
run game, get to the part that freezes, pause the debugger
yeah you seem to be missing the whole "debugging" phase of diagnosing this problem
oh, wait
Logic.GetComponent<RoomHolder>().Rooms.Add(this.gameObject);
if (Rooms.Count < 10)
Unless Unity has a crashlog debuggger
these are two unrelated lists
If unity is frozen, the debugger will be able to stop execution and show you what is going on
your editor isn't instantly crashing
you also got an error, not sure if it is for this but it happens when the freezing starts
(that can happen if you get infinite recursion)
so you'll never stop spawning rooms
debugger works even for infinite loops
I don't understand why the SeedHolder is trying to iterate over a bunch of rooms
No it is
It maxes my ram and goes unresponsive
yes, because it's frozen
it's not a crash. it's just stuck doing a huge amount of work.
I'm not talking about pausing unity.
I'm talking about attaching a debugger to Unity.
Oh like a seperate software
a debugger is a separate program that can monitor another process and interrupt it
Yes
I dont know how to do that
Rider
yes just press the play button in rider
it attaches the debugger
also put down breakpoints
i gotta run, so here's my best guess as to what the issue is
well, in this case
for example a good spot would be on the Instantiate line
and just click this "Debug"
Although, actually, no, they will still help. You might pause the game in some weird place if you just pause randomly.
So, yes, listen to Praetor 😛
I actually knew that how to do that part I just didnt realise my Rider & Unity worked together that much
Thanks
this can be done in unity
error pause
if it shoots error that is, and it looks like it is