Posts: 10
Threads: 4
Joined: Jul 2024
Hi,
I asked about this a couple of months ago and forgot to reply about it. I can't set the CGPathController component's Path property, even though I have a Rasterize Path it in the hierachy. When I click the button that says 'none', nothing appears in the popup list. (it just lists 'none')
This is being done on a prefab outside of play mode. If I press play, and instantiate the prefab, then the list populates in the prefab inspector, and I can select a rasterized path. (The list populates with none, and myGameObject(clone) > rasterize path > rasterize path). But then when I exit play mode, the list depopulates, and I get this error:
MissingReferenceException: The object of type 'BuildRasterizedPath' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
FluffyUnderware.Curvy.Generator.CGModule.get_Generator () (at Assets/Plugins/ToolBuddy/Assets/Curvy/Scripts/CG/CGModule.cs:218)
18)
Are you supposed to be able to setup a CG Path controller on a prefab like this? I'm going to see if I can get this to work through code instead of the inspector. I think I had some trouble with the images on here last time but let me know if there's anything you need a picture of (or any other details).
Thanks,
Jamie
Posts: 2,124
Threads: 93
Joined: Jun 2017
Hi,
I managed to reproduce an issue similar to yours. I will work on it tomorrow. Once fixed, if the fix does not solve your issue, then I will ask for reproduction case and more details.
Will keep you updated.
Have a nice day
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 10
Threads: 4
Joined: Jul 2024
(10-03-2024, 08:30 PM)_Aka_ Wrote: Hi,
I managed to reproduce an issue similar to yours. I will work on it tomorrow. Once fixed, if the fix does not solve your issue, then I will ask for reproduction case and more details.
Will keep you updated.
Have a nice day
Thanks for the help.
Posts: 2,124
Threads: 93
Joined: Jun 2017
Hi,
I found the cause of the issue. Basically Unity offers a method in its API to search for objects of specific type. This is used to find the available generators when showing the popup list. The issue is that said method looks only for objects in scenes, and not in prefab stage (prefab editing scene). I have to go through all usages of this method in Curvy Splines and make sure it handles properly the prefab stage. This will take some time, and will be released in the next update.
Until then, here is a quick fix that you can include in your project:
- Go to \ToolBuddy\Dependencies\DevTools\Extensions\Extensions.cs
- Look for the following method:
Code:
public static T[] FindSortedObjectsOfType<T>() where T : Object
- Replace it completely with this one:
Code:
public static T[] FindSortedObjectsOfType<T>() where T : Component
{
T[] result;
#if UNITY_EDITOR
T[] componentsOfType = StageUtility.GetCurrentStage().FindComponentsOfType<T>();
//handle includeInactive
result = componentsOfType
.Where(c => c is MonoBehaviour m && m.isActiveAndEnabled)
.ToArray();
//handle sortObjects
result = result.OrderBy(c => c.GetInstanceID()).ToArray();
#else
result = Object.FindObjectsByType<T>(
FindObjectsInactive.Exclude,
FindObjectsSortMode.InstanceID
);
#endif
return result;
}
Please note that with this modification, Curvy Splines is nor more compatible with Unity 2020.3. This modification bumps the minimum compatible version to 2021.3.
Please let me know if this fix worked for you or not.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day.
Please consider leaving a
review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Posts: 10
Threads: 4
Joined: Jul 2024
(10-04-2024, 09:26 AM)_Aka_ Wrote: Hi,
I found the cause of the issue. Basically Unity offers a method in its API to search for objects of specific type. This is used to find the available generators when showing the popup list. The issue is that said method looks only for objects in scenes, and not in prefab stage (prefab editing scene). I have to go through all usages of this method in Curvy Splines and make sure it handles properly the prefab stage. This will take some time, and will be released in the next update.
Until then, here is a quick fix that you can include in your project:- Go to \ToolBuddy\Dependencies\DevTools\Extensions\Extensions.cs
- Look for the following method:
Code:
public static T[] FindSortedObjectsOfType<T>() where T : Object
- Replace it completely with this one:
Code:
public static T[] FindSortedObjectsOfType<T>() where T : Component
{
T[] result;
#if UNITY_EDITOR
T[] componentsOfType = StageUtility.GetCurrentStage().FindComponentsOfType<T>();
//handle includeInactive
result = componentsOfType
.Where(c => c is MonoBehaviour m && m.isActiveAndEnabled)
.ToArray();
//handle sortObjects
result = result.OrderBy(c => c.GetInstanceID()).ToArray();
#else
result = Object.FindObjectsByType<T>(
FindObjectsInactive.Exclude,
FindObjectsSortMode.InstanceID
);
#endif
return result;
}
Please note that with this modification, Curvy Splines is nor more compatible with Unity 2020.3. This modification bumps the minimum compatible version to 2021.3.
Please let me know if this fix worked for you or not.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day.
Thanks so much, I will try this later and let you know.