Sometimes I see code that uses a new allocation to set a Unity Vector2/3 with new values instead of Set(), unless I'm missing some setting of the compiler magically replacing that instruction with something else this is a very unoptimized way of doing so.
@djlink did not know this! I also recently discovered you should use trygetcomponent rather than getcomponent because it is allocated even if getcomponent is null!
@commonblob the requested component is allocated? Why can it return true then? I gotta research that
@commonblob ok it appears the memory allocation is in editor mode only to provide some log information which causes mem allocations, good to know. Thanks for the info
@djlink ah, didn't realise it was only editor allocation. Even though, handy. And code looks a bit neater anyway.
@commonblob true, changed a couple of my current algorithm just now for that