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
  Reuse Curvy Generator Wanderfalke 3 123 09-24-2019, 07:07 PM
Last Post: _Aka_
  UV issue with variable mix shape modifier MarioBag 1 73 09-24-2019, 03:51 PM
Last Post: _Aka_
  3ds max import? turbo 9 5,799 09-16-2019, 01:36 PM
Last Post: _Aka_
  Import SVG to JSON?? Saurabh 14 3,582 09-12-2019, 10:53 AM
Last Post: _Aka_

Forum Jump: