[DiscordArchive] what could be the negative consequences?
[DiscordArchive] what could be the negative consequences?
Archived author: IslJack • Posted: 2024-01-30T07:48:29.660000+00:00
Original source
what could be the negative consequences?
Archived author: Northstrider • Posted: 2024-01-30T07:50:04.520000+00:00
Original source
the problem that you are running into is the so called grid. The world is cut into small chunks and when you are not inside of one of these chunks, it wont be updated. so only when you are nearby the npc, it will work. SetActive is a workaround that will mark the npc as 'I am important, so keep the grid cell loaded and update it until I'm not longer active or removed from world'
Archived author: jackpoz • Posted: 2024-01-30T07:50:56.412000+00:00
Original source
that you see cpu usage even with 0 players online and wonder "why is it using so many resources with 0 players online ?"
Archived author: jackpoz • Posted: 2024-01-30T07:51:24.041000+00:00
Original source
and if every NPC would have setActive, it would lag too much as the whole continent will have to be updated
Archived author: IslJack • Posted: 2024-01-30T07:51:40.371000+00:00
Original source
not all, just minions
Archived author: IslJack • Posted: 2024-01-30T07:51:46.488000+00:00
Original source
to get point
Archived author: jackpoz • Posted: 2024-01-30T07:51:51.255000+00:00
Original source
when you use setActive you keep active the whole area around the npc, not just that single npc
Archived author: IslJack • Posted: 2024-01-30T07:52:04.491000+00:00
Original source
ok, i got it
Archived author: IslJack • Posted: 2024-01-30T07:52:08.473000+00:00
Original source
ty
Archived author: Northstrider • Posted: 2024-01-30T07:52:11.667000+00:00
Original source
if your npc is a temporary spawn that will despawn after a given amount of time, SetActive is fine and save to use