Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about calling the SplinePathMeshBuilder Detach Method from code
#1
I have a quick question with regards to calling the Detach method of SplinePathMeshBuilder from code.

Basically I have a script in Unity that I use to randomly spawn multiple prefabs containing curvy splines and then combine these prefabs so that ultimately I end up with 3 larger splines in the scene. The code then steps through each of these splines in turn and generates a rectanglualr SplinePathMesh for each of the splines. At the end of generating each SplinePathMesh my code then calls the Detach method to generate a detached mesh for each spline path. However when I examine the detached meshes in the scene they don't contain any mesh data i.e. they appear as an empty gameobject. Yet the SplinePathMesh components for each spline clearly contain data and are visible in the scene and if I use the Detach button in the inspector the meshes are correctly deatached.

I suspect that either I am calling the method incorrectly at the end of the SplinePathMesh generation i.e. after I have populated the SplinePathMeshBuilder object with parameters. The code that I am using to call the Deatch method is pathBuilder.Detach() , where pathBuilder is the SplinePathMeshBuilder object that I have created in code to generate the SplinePathMesh.

My other thought was whether or not the SplinePathMesh that I'm wishing to detach needs time to initialise as is sometimes the case when you spawn/instatiate splines?

Any help/advice would be appreciated.

 
Reply
#2
Ok fixed the issue I was having and feel rather stupid [img]images/smilies/blush.gif[/img].

It appears that my hunch that the spline mesh needed time to initialise before being detached was correct. Putting a delay between my generation process and the call to the Detach method gave the correct result.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  2D Terrain Question monotonic 5 162 01-01-2021, 07:32 AM
Last Post: _Aka_
  Pre-Purchase question discofever 1 186 11-03-2020, 12:15 PM
Last Post: _Aka_
  Updating old movement code Maltakreuz 3 746 08-18-2020, 04:49 PM
Last Post: _Aka_
  Error: Calling TeleportBy on a controller that is stopped jamesunity 5 1,054 07-13-2020, 12:28 PM
Last Post: _Aka_

Forum Jump: