Hi,
I’m using the Plane class (this one, not the GameObject) in my drag and drop script and I was wondering if there is a way to delete it or clear it.
Without going into too much details, every time an object is clicked I generate a Plane to help me restrict it’s drag movement to the x and z axis. So I’m wondering if I have a ton of these invisible Planes stacking up every time an object is clicked. I can’t null it, clear, destroy, etc. I’m just worried if this “invisible object” may cause some performance issues.
Is there a way to do this or is this generally a non-issue?
Thanks!
that’s a struct not a class, quick google search for “destroying structs” yields comments like
might want to have a look at this:
1 Like
If you like and if it does not muck up the structure of the code too much, you could create a single Plane structure once and use it indefinitely for all your Plane needs, simply adjusting the values within it.
However, if you are not sure that making new Planes again and again is a problem, don’t bother modifying it because then it is simply a useless optimization that won’t help you and will make the code more complex.
@LeftyRighty is correct.
Planes are struct, no need to worry about it.
That’s what I figured, just need to make sure. Thanks everyone!