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?
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
(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
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
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
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
  snap to the curve created by the curvy splines segment points ShiroeYamamoto 0 0 1 hour ago
Last Post: ShiroeYamamoto
Exclamation Extending Curvy Generator for Advanced Lofting - Feasibility Check amutp 2 4 Yesterday, 07:25 AM
Last Post: amutp
  8.8.0 is live, and it improves Curvy Generator greatly _Aka_ 0 6 Yesterday, 03:23 AM
Last Post: _Aka_
  Using Unity's SplineContainer in Curvy Splines dlees9191 3 15 02-26-2024, 09:49 AM
Last Post: _Aka_

Forum Jump: