Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Have generator run only once
#1
Hi - I am using a generator to add objects along a spline, via a script in Unity edit mode. This works fine: when I run the script, generators get placed in the hierarchy, and the objects are created correctly.  However, it turns out that every time I play the game, these objects get generated again. How can I stop a generator from running during Play? I only want them to run once, in the editor, when I am putting together the scene.
Reply
#2
Hi

Unlike the impression I was under, there is indeed no way to avoid them getting generated when entering play mode. I will have to implement a solution to your problem. Until then, here is how you can do it:
In the CurvyGenerator.Update() method, add the following at the method start:
if (AutoRefresh == false) return;
Then set the AutoRefresh boolean in your generator's inspector to false. That should do the trick.

Let me know if you need further help
If and when you feel like it, please leave a review for the asset, that helps a lot.
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
#3
Sorry, but that doesn't work. If I put the statement in Update() at the beginning, the objects never seem to get generated at all ever, even from the editor.
Reply
#4
Hi

Sorry, I assumed you were familiar with Auto Refresh.

When auto refresh is set to false, the curvy generator refreshes only when you order it to, meaning clicking on the refresh button in its toolbar, or via the API.
So basically I was thinking that you would do the changes you need in edit mode, either by having auto refresh set to true or by manually refreshing, then when you want to enter edit mode you make sure auto refresh is false.

Is this a satisfying answer?
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
Thanks, but I couldn't get that to work. If the patch was in CurvyGenerator.Update and AutoRefresh=false, the objects were never drawn via manual refresh . I got around the problem with AutoRefresh=false, and then by disabling the Generator components after drawing my initial objects (in a coroutine after a wait).
Reply
#6
(09-13-2021, 10:25 PM)topquarkone Wrote: If the patch was in CurvyGenerator.Update and AutoRefresh=false, the objects were never drawn via manual refresh
Oh sorry, you are completely right. Glad you found a workaround. Sorry for not being useful.
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#7
No problem! I do have another question, but I'll put in new thread.
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 6 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: