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
  Intersection of two curvy splines Einherj 1 3 6 hours ago
Last Post: _Aka_
  Curvy Generator Exception niek352 2 10 07-14-2022, 02:59 PM
Last Post: niek352
  Curvy 8.2.0 is live _Aka_ 0 6 04-26-2022, 02:09 PM
Last Post: _Aka_
Exclamation Runtime error when using Curvy Generator with Game Object Deform studentloan 3 13 04-22-2022, 09:00 PM
Last Post: _Aka_

Forum Jump: