Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Null reference exception in CurvyCamController
#1
Good evening!

I'm just beginning with Curvy (and loving it so far), but I found a bug in the CurvyCamController example. Okay, maybe it's not a bug because it's in an example, but I think a lot of people will try (as I did) to reuse the script in a project.

In the OnPreRender() method, there is this code:

Code:
FX_DOF.aperture = Mathf.Lerp(....);


That's fine if a DepthOfField effect is desired, but if that component isn't on the camera, then this throws a null pointer exception every frame. May I suggest wrapping that in a conditional to avoid the null error? Smile
Reply
#2
Hmm, I'm not sure about it. Yes and no.... Okay, checking for errors is good coding style, so that makes sense in almost any case. On the other side we want to keep the example scripts to be as short as possible and focused on the relevant Curvy API parts. Adding all sorts of logical checks (and stuff like Requirecomponent(Camera) etc...) may draw attention away from that.

Also, almost all example scripts are composed for a single showcase and won't make much sense in other context.
Reply
#3
(04-13-2016, 06:36 PM)Jake Wrote: ...we want to keep the example scripts to be as short as possible and focused on the relevant Curvy API parts. Adding all sorts of logical checks (and stuff like Requirecomponent(Camera) etc...) may draw attention away from that.

Also, almost all example scripts are composed for a single showcase and won't make much sense in other context.

I see your points, on both counts. :-) The camera controller is very useful outside the context of the one demo, IMO. Maybe the solution is to make that part of the core code instead of an example.

Mea culpa for my not taking into account the fact that it *is* an example. I should myself have done what I just suggested above, namely copy it out of your example folder into my own script folder and consider it "forked" from the example.

Whatever course of action you decide to take here, including simply closing my issue and considering it "working as designed," is okay with me. I feel your explanation is reasonable for why things are as they are. :-)
Reply
#4
Tbh, we had a discussion in the past whether to remove the 98_Curvy example because it's not demonstrating something new, just another version of a custom controller and some CG extrusions.
Reply
#5
(04-17-2016, 01:05 PM)Jake Wrote: Tbh, we had a discussion in the past whether to remove the 98_Curvy example because it's not demonstrating something new, just another version of a custom controller and some CG extrusions.

Maybe this would be a good candidate to remove the "tube" part of the demo and leave the "checkpoints". That would solve my request for an example that just places objects along a spline without the complexity of cross-section generation and extrusion.

I have another thought about that documentation thread, but I'll post there instead of here to stay on topic. :-)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting reference to Generator and InputSplinePath Spline velikizlivuk 3 9 08-15-2023, 11:08 PM
Last Post: velikizlivuk
Bug Argument Null exception Beqo77 5 17 04-24-2023, 08:26 PM
Last Post: _Aka_
  Null Ref when using Connections RKTRAINS 1 2 10-10-2022, 08:49 AM
Last Post: _Aka_
  Curvy Generator Exception niek352 2 11 07-14-2022, 02:59 PM
Last Post: niek352

Forum Jump: