Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about generator
#1
Hello 

I am using generator to spot multiple objects along the spline, I do that at run time. I modified the range for rasterized path to be for a part of the curvy spline and not for the full range (ex.  0 - 0.3), and I want to modify that range on other part of spline while player is moving across the spline when he reaches specific distance ( for ex. when player move after 25 distance I want the rasterized path range to be 0.3 - 0.5)

-I was wondering if at run time the generator will reuse the already spotted objects ? or it will destroy them and then reinstantiate them again (if yes can I reuse them)?
-Is there any tips to get max performance for the Generator that will spot a game objects on spline ( all the spotted object are simply sprites only with only sprite renderer component)?
Reply
#2
Hi
Sorry for the late reply: I did answer the day you posted, but the answer was not posted, probably because of the problematic internet connection I am having now

So I was saying that CG (Curvy Generator) uses pooling to avoid recreating game objects. There are still some .net objects that get allocated at each CG refresh, but there aren't that many when running outside of the editor. In editor there are some more allocations to handle things related to the editor. I am working on a big update that will take at least 6 months to be finished, and part of that update is to reduce even more the allocations done by the CG

Regarding performance tips, I recommend this link
https://curvyeditor.com/documentation/performancetips
Also, I recommend to use Unity's profiler to see exactly what is taking the most time and memory. When doing so, and if you profile inside the editor, try to distinguish what is part of editor only code, and that will not be part of a build. It is usually code in the Editor folders, and code surround with a #if UNITY_EDITOR   #endif

I hope this helped
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
No worries your support is super ,

To make sure I understood the answer. You mean if the Spot Generator for example created 20 trees and 10 street light ( these are simple game object with sprite renderer) on range from: 0 to 0.25 . and I then updated the generator range to be from 0.25 to 05 and make refresh, then the generator will use these 20 trees and 10 street lights game objects that was already created , I am i right here?

but is there any possibility that the generator might delete (or event instantiate a new one) objects from the 20 tree and 10 street light ?
if I make the seed a fixed value and not random does this guarantee that object will be always the same and will not be deleted or instantiate a new one?
Reply
#4
(02-11-2021, 06:53 PM)Mos Def Wrote: No worries your support is super ,



To make sure I understood the answer. You mean if the Spot Generator for example created 20 trees and 10 street light ( these are simple game object with sprite renderer) on range from: 0 to 0.25 . and I then updated the generator range to be from 0.25 to 05 and make refresh, then the generator will use these 20 trees and 10 street lights game objects that was already created , I am i right here?



Yes you are right.



Let me explain to you how pooling works in Curvy Generators:



If you select your Curvy Generator game object, you will find that it has zero or multiple components of type Prefab Pool and Component Pool. These components are added automatically to the CG depending on its needs. You are not supposed to add them yourself. The whole pooling process is supposed to be transparent to the users.



Both Prefab Pool and Component Pool behave similarly, and are parametrized similarly.



Prefab Pool, unlike what its name suggests, does not pool only prefabs, but also normal game objects. So no worry, if you use a normal gameobject as an input to your Spot Generator, it will be pooled too. This badly chosen name, and other badly chosen names and weird design decisions do bother me, but since 99% of users don't have to touch anything related to pools, this makes a refactoring of the pooling related code not at the top of my todo list.



If you go to the inspector of one of those pools, you will see something like this (I modified the parameters values):



   



The Debug option allows you to log all what the pool does, so you can know when it creates new objects.



The pool starts empty, so the first batch of your 30 objects will be created at the first CG update. Then at every update, these objects will be pushed in the pool when clearing the existing objects, and popped from it when generating the 30 new objects.



The Min Items option allows you to define a number of objects that should be all the time available at the pool.

The Threshold option is a Max Items option, but badly named.



Every-time the number of items in the pool is outside of those two boundaries, the exceeding/lacking objects will be removed/created, at a speed that is supposed to be the Speed value. But the actual speed is something different. Either I don't get the intention of the person who implemented the Speed thing, or it is bugged (I lean towards the second explanation).



Finally, the pooling is intentionally deactivated in edit mode. Why? I have no idea.

I explained all this just to give you more knowledge about how things work, but keep in mind that you almost certainly don't need to parametrize anything related to pools. Cases where the default parameters need to be modified are rare

Let me know if things are still not clear
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#5
And please forgive the duplicated empty lines, I don't know what happened
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#6
Man your support is really outstanding , Thanks a million. I wish i can give more than 5 stars in assets store. every thing is crystal clear now.
Reply
#7
Thank you Smile
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#8
Those settings were improved and properly documented in version 8.5.0 that was just released. Thanks for your patience.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 0 5 Yesterday, 03:23 AM
Last Post: _Aka_
  Generating GO only on CPs in Generator GameDeveloperek4123 1 6 03-04-2024, 11:06 AM
Last Post: _Aka_
Question Generator Canvas workflow issues Sacryn 1 7 02-02-2024, 11:22 PM
Last Post: _Aka_

Forum Jump: