Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change to Random Spline on End Reached Event
#1
Hi there.  I'm currently working on a 2.5 top down shooter and I'm looking to use Curvy for enemy movement in the game.  I'm trying to setup the following scenario where the enemy chooses a random path once it reaches the end of the current path it's on.  Here's what I've got:

* I've created a couple Curvy splines that I've saved as prefabs.
* I added the spline prefabs to a list of available paths that the enemy can take.
* I wired up a function in code to handle the OnEndReached event using AddListenerOnce.

This all works fine until the OnEndReached event fires.  I set the controller's spline to a new instance of the random prefab I selected, that works... but then Unity hangs for several seconds with several warnings / errors, then continues with the new path.

   

After running it through the debugger in Visual Studio, it appears that I'm stuck in a tight loop of calls to the OnEndReached event... at least I keep stopping at my breakpoint in the method.  I had searched a bit on the forum for something similar and found this post:

https://forum.curvyeditor.com/thread-568.html?highlight=switch

It sounded like I just needed to set the spline on the controller to startup the new path.  I've tried stopping and/or refreshing the path but it does the same thing.  I'm probably doing something goofy as I'm still noobish on using Curvy, but I'm not sure at the moment. Smile  Any thoughts would be appreciated.  Thanks.
Reply


Messages In This Thread
Change to Random Spline on End Reached Event - by ricke - 09-11-2021, 12:57 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: