Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import Curvy from json Issue
#1
Hello,

   I am importing a json created by json Utility with a SerializedCurvySpline. 


Code:
  SerializedCurvySpline newSpline = new SerializedCurvySpline(JsonUtility.FromJson<CurvySpline>(File.ReadAllText(pathPath)),CurvySerializationSpace.Global);
           CurvySpline cs = path.AddComponent<CurvySpline>();
           cs = new CurvySpline(newSpline);

I have tried this several ways and it complains about two things.

  1. Assets/Plugins/Curvy/Base/CurvyUISpline.cs(17,18): error CS1729: The type `FluffyUnderware.Curvy.CurvySpline' does not contain a constructor that takes `0' arguments
  2. Says that the constructor of CurvySpline doesn't take one argument. 
Is this something to do with the partial classes and the inheritance in UICurvySpline? How do I make a new CurvySpline from a json?
Reply
#2
Hi,
Those errors are compile time errors, right?
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#3
(05-29-2019, 03:17 PM)_Aka_ Wrote: Hi,
Those errors are compile time errors, right?

Yes.

EDIT: THAT IS THE FASTEST RESPONSE EVER!
Reply
#4
Hahaha, thanks. Too bad my second answer is not at the same level of speed. It's not my fault, it's Kojima's Big Grin

About your issue, replace your last line of code with one
Code:
newSpline.WriteIntoSpline(cs, CurvySerializationSpace.Global);
I have to admit that I don't remember if the Start() method is called automatically by Curvy at the same frame when calling AddComponent. If you have any issue with the spline initialization, try calling cs.Start() before using cs
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply
#5
(05-29-2019, 04:38 PM)_Aka_ Wrote: Hahaha, thanks. Too bad my second answer is not at the same level of speed. It's not my fault, it's Kojima's Big Grin

About your issue, replace your last line of code with one
Code:
newSpline.WriteIntoSpline(cs, CurvySerializationSpace.Global);
I have to admit that I don't remember if the Start() method is called automatically by Curvy at the same frame when calling AddComponent. If you have any issue with the spline initialization, try calling cs.Start() before using cs

This worked great. Sorry I didn't see that in the docs. Thanks again!
Reply
#6
You are welcome
Available for freelance work, feel free to reach out: toolbuddy.net
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 7 1,249 07-13-2025, 07:11 PM
Last Post: _Aka_
  Invisible Gizmos In Latest Curvy Splines orrenravid1 1 432 06-11-2024, 07:36 AM
Last Post: _Aka_
  Rasterized Path Range issue proton 7 1,379 04-30-2024, 11:17 AM
Last Post: _Aka_
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 1 441 04-03-2024, 03:16 PM
Last Post: _Aka_

Forum Jump: