Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setup Generators in code
#2
Hi Jake, I'm not sure why your previous response has been deleted. I'm trying to use the approach you described but I'm receiving an error:

"The object you want to initiate is null" stack trace refering to the CreateMesh.cs: 457

I'm attempting to use the generator you setup in the examples 15_CGExtrusionAdvanced with my own spline data, using the following code. Any thoughts on where this is going wrong?

Code:
       Track[] tracks = trackList.Track;

       CurvyGenerator cgen = FindObjectOfType(typeof(CurvyGenerator)) as CurvyGenerator;

       cgen.AutoRefresh = false;
       List<CreateMesh> cm = cgen.FindModules<CreateMesh>();

       for (int i = 0; i < MAX_TRACKS; i++)
       {
           ArrayList coords = Strings2Vec3Arr(tracks[1]);
           GameObject instance = InstantiateSectie(coords);

           attachCurvySpline(instance, coords);

           cgen.Refresh();

           foreach (CreateMesh cm_i in cm)
           {
               cm_i.SaveToScene();
           }

       }
Reply


Messages In This Thread
Setup Generators in code - by Leks1NL - 07-24-2017, 04:06 PM
RE: Setup Generators in code - by Leks1NL - 07-27-2017, 07:48 PM
RE: Setup Generators in code - by Jake - 07-29-2017, 05:52 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple Splines and Generators Performantly for Road System drock 1 6 07-17-2023, 10:31 AM
Last Post: _Aka_
  Permission to publish custom CGModule source code? Apelsin 6 9,422 09-15-2022, 08:53 PM
Last Post: Josaf Tom
  Import/Export, Spline from code Mos Def 4 783 02-14-2022, 11:42 AM
Last Post: _Aka_
  Code snippet to automatically set UV Edge to true _Aka_ 0 13 12-20-2021, 04:29 PM
Last Post: _Aka_

Forum Jump: