C
C#5mo ago
Maujey

How to use ExtensionMethods for structs

No description
No description
4 Replies
Marvin
Marvin5mo ago
Extension methods only work on instances and cannot be used in a static context like you are trying to.
Maujey
MaujeyOP5mo ago
is there any other way around it?
Marvin
Marvin5mo 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
Maujey
MaujeyOP5mo ago
sure thanks!

Did you find this page helpful?