Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with prefabbed splines
#1
Hello, I just acquired Curvy Splines 8 and I have a question about Curvy Splines and Prefabs. So far I've been experiencing quite a few challenges/issues in Unity 2021.3.18.

Context: In the game, I want to load a Prefab with a network of rails (several Curvy Splines). When starting a playthough, the game picks one network of rails Prefab out of a collection, and instantiates it.

Challenges: 
1. Strange behaviours happen when editing the Prefab with Unity Editor's Prefab editor (not in an Scene). Some memory leaks seem to happen as memory allocation logs and errors keep on stacking in the Console Log. The Unity Editor must be restarted to fix this.
2. Ideally, I would prefer for the level designer to have one Scene where he can edit all rail networks (instead of having to create separate Scene for each). However, I think the dependency on CurvyGlobal's caching does not allow for this.
3. Each network of rails will have different curves but should share the same Curvy Generator. Is there a best approach for this?

With this, is there an advice on how to best approach these challenges? How can I best instantiate sets of Curvy Splines in runtime?
Reply
#2
Hi
Thanks for acquiring Curvy Splines.
Here are my answers about each point:
  1. Hi. This is a known issue. Its fix is implemented in my dev branch, and should be available with the next update. Until then:
        - Try the following work around: have a CurvyGlobal  in your scene first, then edit the prefab.
        - I can send you WIP version that would include the fix once I stabilize the code in my development branch. This can take some time, since I am in the process of implementing fundamental changes. Please let me know if you are interested.
  2. As far as I am aware, you can edit all the railways in one scene. Can you please detail to me what stops you from doing so?
  3. You can set the generator, with no input splines in a prefab. you instanciate the prefab using Unity's API, then you can use Curvy's API to set the spline for your input modules. Let me know if you strugle finding how to do that.

Did this help?
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
Hello,

Thank you for such a quick reply.

1. Thanks for the tip. I am interested in receiving the pre-release WIP once it is stable. I have a couple of months until production launch, so the WIP would help during development.
2. If I edit all different rail network (separate) Prefabs in one scene, does the CurvyGlobal store any cached information about them in the Scene? Maybe I am confused about the responsibilities of the CurvyGlobal:
2.1 Does it store information in Edit Mode into itself/Scene that is crucial for the CurvySplines to operate? Therefore, if I instantiate a CurvySpline from a Prefab do I need to instantiate the same CurvyGlobal from the Scene that spline was created?
2.2 Or does it just store information in Play/runtime? I think my confusion stems from the Curvy Spline connections being stored in the CurvyGlobal during Edit Mode.
3. Thanks for this answer. I managed to get it working yesterday and ended up with the same solution as your advice. Good to know I am in the right path.
Reply
#4
About _CurvyGlobal_: It is used for two different purposes.
  1. Pooling: in the context of this purpose, deleting _CurvyGlobal_ should not have negative consequences, except the lack of performance due to instantiating new objects instead of using the pooled ones.
  2. Connections: all connections of the scene are stored as children gameobjects of _CurvyGlobal_. So if you deleted the latter, all your connections will be lost.
When opening multiple scenes having each of them a _CurvyGlobal_ instance, those instances are merged into only one, that will contain all the connections of the merged instances.
The association between _CurvyGlobal_  and connections comes with its issues. I wish to disconnect both concepts in the future, but this isn't for the near future.

So to summarize, as long as you don't use connections, you can deleted _CurvyGlobal_ without issues.
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
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 8 02-26-2024, 09:49 AM
Last Post: _Aka_
  Distance travelled across multiple splines jh092 1 5 02-23-2024, 09:44 AM
Last Post: _Aka_
  Finding relative position across connected splines DekoGames 1 5 02-05-2024, 10:11 PM
Last Post: _Aka_
Wink Modifying Splines at Runtime artsung 1 4 01-30-2024, 09:40 AM
Last Post: _Aka_

Forum Jump: