Announcement

Collapse
No announcement yet.

Spawned decals get deleted periodically

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Spawned decals get deleted periodically

    Hi

    I am looking for a way to stop ue4 from automatically trash-collecting all spawned decals every 20 or so seconds.
    All I have managed to find regarding this topic was an old c++ thread.

    Would be awesome if you guys could help me with this
    Attached Files
    Last edited by iNviSible.yuno; 11-06-2014, 08:14 AM.

    #2
    Ok my mistake its more like 45 seconds untill they get deleted ingame.^^

    Comment


      #3
      Hello,
      if you use "spawn decal at location", have you set life span (0 = infinite) ?

      Comment


        #4
        Yes. But "infinite" pretty much means 45 seconds, because after that they' ll be deleted... just one spawned decal remains.

        Comment


          #5
          It seems to be because of the garbage collection. In c++ a registered in Tarray seems solving the issue. Maybe add them in an array in blueprint will do it too. (only an idea, i haven't try it.)

          Comment


            #6
            Originally posted by Fen View Post
            It seems to be because of the garbage collection. In c++ a registered in Tarray seems solving the issue. Maybe add them in an array in blueprint will do it too. (only an idea, i haven't try it.)
            Thanks you, you are awesome! Solved.
            Attached Files

            Comment


              #7
              You'll have to kill them eventually because otherwise the resource usage will spiral out of control.

              AFAIK you shouldn't see garbage collection sweeping them up if you actually define a lifetime for them, so do that. Define, say, a 120 second lifetime, or something else suitably long-lasting for what you're doing.

              The advantage to doing this is that by doing so, they'll die one at a time (rather inconspicuously) instead of all being mass-swept away by garbage collection. I had to do this with bullet hole decals and physics particles that come to rest; if you try to make them last forever, eventually they'll all get mass-collected as garbage. But if you define them as having a lifetime, they'll survive periodic garbage collection and will die corresponding to when they were spawned, which means there are almost always a bunch of them around, making it essentially impossible to notice the ones that disappear (unless you happen to catch a glimpse of one right at that critical moment or have a really good instinct for how quickly an arena should fill up with decals and detritus)

              Granted the array method might make them last forever, but be careful doing that as you can very quickly wind up with an unmanageable number of decals (not necessarily just for memory reasons, but aesthetic ones as well)

              Comment


                #8
                Originally posted by RhythmScript View Post
                You'll have to kill them eventually because otherwise the resource usage will spiral out of control.

                AFAIK you shouldn't see garbage collection sweeping them up if you actually define a lifetime for them, so do that. Define, say, a 120 second lifetime, or something else suitably long-lasting for what you're doing.

                The advantage to doing this is that by doing so, they'll die one at a time (rather inconspicuously) instead of all being mass-swept away by garbage collection. I had to do this with bullet hole decals and physics particles that come to rest; if you try to make them last forever, eventually they'll all get mass-collected as garbage. But if you define them as having a lifetime, they'll survive periodic garbage collection and will die corresponding to when they were spawned, which means there are almost always a bunch of them around, making it essentially impossible to notice the ones that disappear (unless you happen to catch a glimpse of one right at that critical moment or have a really good instinct for how quickly an arena should fill up with decals and detritus)

                Granted the array method might make them last forever, but be careful doing that as you can very quickly wind up with an unmanageable number of decals (not necessarily just for memory reasons, but aesthetic ones as well)

                Thanks man thats good to know. Thanks for the reply.
                For my game, I ll have to find a way to make this work though since it is about painting. I ve seen the framerate go down up to 8 frames when iam painting fot a long time at the same place and thats fine. Memory could become a problem though. i might have to kill those decals if the character is more than x meters away or go for short levels... not sure yet.
                Last edited by iNviSible.yuno; 11-06-2014, 01:57 PM.

                Comment


                  #9
                  Maybe you can store them in different arrays depending on location in level and spawning back them when needed if you don't want to clean your array. (or use streaming levels and store in array in streaming level.) They will appear disappear with the level.

                  Comment


                    #10
                    Thats a pretty good idea

                    Comment

                    Working...
                    X