Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Assign Input Spline Path to Generator at Runtime?
#1
Hi there,

I am attempting to instantiate a Curvy Generator at runtime and assign an existing Spline in the scene as the Input Spline Path.  I'm having tremendous trouble  making this happen.  Once the Generator is instantiated from a prefab, it's child object "Input Spline Path" asks me to create or assign a spline.  This is where I get stuck.  I can't figure out how to do this, and I've tried everything!  Please advise.  I've attached a screenshot as well.  

Thanks so much!

Michael

   
Reply
#2
Hey Jake... any tips on this?
Reply
#3
InputSplinePath has a Spline property you can set at runtime:

Code:
var isp = MyCG.GetModule<InputSplinePath>("InputSplinePath",true); // or get reference to module component otherwise
isp.Spline=mySpline;
Reply
#4
This code fragment isn't working in Unity 2017.1.0f3. GetModule returns null even though it does exist in the scene.
Reply
#5
Have a look into the 51_InfiniteTrack example. The InfiniteTrack script does the same you want, but it stores the reference to the input module on creation. The only reason for GetModule to fail I see is that the module name is wrong.

Does FindModules<InputSplinePath>(true) return something?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  SplineController Ignores Follow-Up and Chooses Wrong Spline Josenildo 7 2,326 07-29-2025, 09:15 PM
Last Post: _Aka_
  Curvy Line Renderer for UI Spline? gekido 7 3,896 07-13-2025, 07:11 PM
Last Post: _Aka_
  Is there a way to get the position of each ControlPoint in spline by API? Chanon 1 1,460 06-07-2025, 09:44 AM
Last Post: _Aka_
  How to rotate generator asteroids patndan74 6 2,414 05-08-2025, 10:07 PM
Last Post: _Aka_

Forum Jump: