Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating a ring of rectangles, then create series of rings to create a cylinder
#1
Hi guys,

here is what I'm trying to achieve: 
1. Create a ring of rectangles according to a circular spline
2. Create a bunch of these rings next to each other to create a cylinder of rectangles of rings 

I have achieve the effect of this but however I cannot build the project on VR with oculus. 

Before I build, console already outputs errors:

NullReferenceException: Object reference not set to an instance of an object

FluffyUnderware.Curvy.Generator.Modules.CreateGameObject.OnDestroy () (at Assets/Plugins/Curvy/Base/CG Modules/CreateGameObject.cs:104)
UnityEngine.ObjectBig GrinestroyImmediate(Object)
FluffyUnderware.DevTools.PrefabPoolTongueush(GameObject) (at Assets/Plugins/DevTools/Components/PrefabPool.cs:227)
FluffyUnderware.Curvy.Generator.CGGameObjectResourceLoaderBig Grinestroy(CGModule, Component, String, Boolean) (at Assets/Plugins/Curvy/Base/CG/CGResource.cs:255)
FluffyUnderware.Curvy.Generator.CGResourceHandlerBig GrinestroyResource(CGModule, String, Component, String, Boolean) (at Assets/Plugins/Curvy/Base/CG/CGResource.cs:71)
FluffyUnderware.Curvy.Generator.CGModuleBig GrineleteManagedResource(String, Component, String, Boolean) (at Assets/Plugins/Curvy/Base/CG/CGModule.cs:609)
FluffyUnderware.Curvy.Generator.Modules.CreateGameObject:Clear() (at Assets/Plugins/Curvy/Base/CG Modules/CreateGameObject.cs:122)
FluffyUnderware.Curvy.Generator.Modules.CreateGameObject:Refresh() (at Assets/Plugins/Curvy/Base/CG Modules/CreateGameObject.cs:142)
FluffyUnderware.Curvy.Generator.CGModule:doRefresh() (at Assets/Plugins/Curvy/Base/CG/CGModule.cs:825)
FluffyUnderware.Curvy.Generator.CurvyGenerator:Refresh(Boolean) (at Assets/Plugins/Curvy/Base/CG/CurvyGenerator.cs:595)

and when I build, I get another reoccurring error message:

ID of 'Create GameObject_7_GameObject7_GO ring001' isn't unique!

UnityEngine.Debug:LogError(Object)
FluffyUnderware.Curvy.Generator.CurvyGenerator:Initialize(Boolean) (at Assets/Plugins/Curvy/Base/CG/CurvyGenerator.cs:530)
FluffyUnderware.Curvy.Generator.CurvyGenerator:Update() (at Assets/Plugins/Curvy/Base/CG/CurvyGenerator.cs:243) 

For some context, the first ring of rectangles I got from step 1 I created a prefab of and fed into step 2 generator. The name of the prefab is called GO ring,


THANKS
Reply
#2
Hi,
I haven't looked deep it this yet, but from a first look, I think that the issue comes from GO ring having a generator in it. Try modify your setup having only the meshes in GO ring, and not the generator. The "Save To Scene" button in the Create mesh module might help you exporting the created meshes outside of the curvy generator.
Is my explanation clear?
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
Hi,

Here is the code modification to avoid your issue. Go to CurvyGenerator.cs, and in the Initialize method, replace the first for loop with this one:
Code:
for (int i = 0; i < Modules.Count; i++)
               {
                   CGModule cgModule = Modules[i];

                   if (!cgModule.IsInitialized || force)
                       cgModule.Initialize();

                   //This happens for example if a generator creates GameObjects that are generators themselves
                   if (cgModule.Generator != this)
                       continue;

                   if (ModulesByID.ContainsKey(cgModule.UniqueID))
                   {
                       Debug.LogError("ID of '" + cgModule.ModuleName + "' isn't unique!");
                       return;
                   }
                   ModulesByID.Add(cgModule.UniqueID, cgModule);
               }

I still recommand you to use GO ring as a way to make the ring, and put the ring itself, stripped from the generator, as an input to the second generator. This way you will use less CPU and memory.
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
  Move the Create Mesh of a CurvyGenerator Out of the Main Parent UsernameHed 3 281 07-08-2019, 06:57 PM
Last Post: _Aka_
  Creating a road dazz777 3 405 06-21-2019, 09:36 AM
Last Post: _Aka_
  Creating connection from code kardoser 5 1,632 02-27-2019, 11:29 AM
Last Post: _Aka_
  Trying to create a moving train that slows and stops at stations Novian 7 2,866 09-13-2018, 08:46 PM
Last Post: ClaudePorter

Forum Jump: