Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Duplicate Volume references become null
#1
Hi

I'm creating a game which uses a series of extruded volumes for a ski slope. I've just duplicated one of these courses in order to make a modified version but I'm getting now a lot of errors about null references. I'm referencing the course sections with the following code:

Code:
[CGDataReferenceSelector(typeof(CGVolume), Label = "Volume/Path_1"), SerializeField]
public CGDataReference Path_1 = new CGDataReference();

In the editor the references appear to be there and pointing to the right game objects but when I run the game I get a lot of errors and in the debugger the underlying "slot" for the reference is null. I don't really know how these are serialized except that they are using some non-standard magic so I'm guessing that duplicating the old curves has left some bad data in the serialized object. Does anyone know if it's possible to fix this, or if there is a method for duplicating curves which will keep references like this intact?


Attached Files Thumbnail(s)
   
Reply
#2
Hi,

I tried to reproduce the issue but couldn't. Can you please send me a reproduction case?

I attached my test scene, with is simply a test gameobject referencing a curvy generator using the
CGDataReference class. Duplicating the test gameobject did not produce any issue on my side.

Have a nice day


Attached Files
.unitypackage   test.unitypackage (Size: 6.68 KB / Downloads: 1)
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Hi, thanks for the quick response. I've attached a trimmed down version of the scene with the error. I did try your example and didn't get the error so I'll continue to look at my end to try to figure out the reproduction steps.


Attached Files
.unitypackage   curvy-reference-error-scene.unitypackage (Size: 14.87 MB / Downloads: 1)
Reply
#4
Ok, I think I've managed to solve this. It wasn't the duplication that was the cause, but actually a similar problem to a previous thread I posted. I was waiting one frame to allow Curvy to populate its internal refs and get initialized which had worked, but now I have more volumes in my scene it seems to be taking longer. I'm checking now during update and retrying until I get the volumes, and it seems to take 3-4 frames to get all 6 that I need.
Reply
#5
Hi,
For some weird reason, I can't post my full answer, so I posted it on this pastbin https://pastebin.com/kR3DWavX
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#6
Hi thanks for that. The extra delay frames may have to do with my setup code, the parent of the curvy object gets deactivated when the game starts, then reactivated when the player starts a race, so maybe that causes a bit of unusual behaviour during the curvy setup.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  OnAfterControlPointAdded - Control Point is null jh092 5 210 02-04-2025, 09:31 PM
Last Post: _Aka_
  Duplicate Prefab along path rickgplus 1 129 01-23-2025, 10:09 AM
Last Post: _Aka_
Photo Volume Spots problem with spacing Bond007 3 131 01-20-2025, 12:27 PM
Last Post: _Aka_
  Nested Spline Volume Spot Instantiation merobbins5 3 101 07-26-2024, 09:58 AM
Last Post: _Aka_

Forum Jump: