C
C#6mo ago
Mojee

How to use ExtensionMethods for structs

No description
No description
4 Replies
Marvin
Marvin6mo ago
Extension methods only work on instances and cannot be used in a static context like you are trying to.
Mojee
MojeeOP6mo ago
is there any other way around it?
Marvin
Marvin6mo ago
Now there are two paths you could take, make it so you call velocity = velocity.ClampLength(MAX_SPEED) or have a static helper class velocity = Vector3Helper.ClampLength(velocity, MAX_SPEED). And probably some other options too
Mojee
MojeeOP6mo ago
sure thanks!

Did you find this page helpful?