Open DaZombieKiller opened 5 years ago
Whoa cool! I am a complete C# noob so while I had read about something called IDisposable
I didn't fully understand why I should have used it instead of the finalizer. I also didn't know about a bunch of the coding conventions you used in your code snippet, so this is really helpful. Thanks!
I'm glad to have helped!
Hi, I've been hoping to use this Unity plugin for an NLP-related application that, curiously, uses 3D visualization. So, I'll be using Unity and hoped to leverage Pathfinder via this plugin.
Since I'll need to render LOTS of words, like whole documents, my thought had been to start with a "word-as-mesh" library and serialize a dictionary of strings, plush PF Mesh data (?), to disk and load in the needed meshes depending on text content.
With all that said, if I wanted to "save" the mesh that PF uses to render to canvas, what property or method would I use to get a mesh from a string at runtime? I can handle the serialization.
Any ideas/feedback appreciated.
Thanks, Dave Gerding
Instead you should implement
IDisposable
and use a class inheriting fromSafeHandle
to represent the native handle. The reasoning for why can be found here.The autogenerated bindings can then take/return an instance of that
SafeHandle
derivative instead of anIntPtr
(althoughPFPathDestroy
should still takeIntPtr
).The
PFPath
class would look something like this after incorporating the changes (it could also optionally be transformed into astruct
instead of aclass
now that it doesn't rely on a finalizer):