0
Completed

Extention Methods

Zefugi 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 7

How about supporting extension methods?

Example:


public static class TransformExtentions
{
    public static void SetEulerForAxis(this Transform transform, float angle, Vector3 axis)
    {
        transform.eulerAngles = axis * angle;
    }
}


When compiled in unity, this adds a SetEulerForAxis method to the Transform class, but Bolt does not seem to recognize the extension.

See also https://support.ludiq.io/communities/5/topics/1280-how-do-i-set-just-a-single-axis-of-euler-rotation-using-bolt

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Completed

Hi Zefugi! This is already available. You just need to add the class TransformExtensions to your unit options wizard for Bolt to recognize it.

Did Bolt 1.2.3 support this? I tried it right after read this thread, but can not add my extension class.

I found any custom static class and static method can not be added by Unit Option Wizard.


They should be there; if they aren't, please submit a bug report with your OS and Bolt version! Really helps me keep track of each issue separately.

Great !! =D My life just got 2% better.

Couple of follow-ups...

Can I add an entire namespace in unit options?

Why is this not done by default? (Why do I need to add these, specifically)

Actually on the be roadmap for next minor release cycle :) 1.4. read Lazlos last comment

https://support.ludiq.io/communities/5/topics/831-adding-custom-types-in-bulk

Ah, I seem to have read that part and forgot about it again. ;-)

Thanks