How to create a Code Template in Rider on array type specifically (for postfix character)?

487 Views Asked by At

I want to have an ability to write someArray.rnd and I want it to generate the below code:

UnityEngine.Random.Range(0, someArray.length)

I found these Postfix Templates, but I see no option to define our own for C#, only for Javascript/Typescript. Is this possible to have code generation like this in Rider for Unity?

1

There are 1 best solutions below

0
On

No, afaik you cannot create Postfix Templates from a handy tool, e. g. like the Template Explorer in Visual Studio.

You either develop a custom plugin (which is not very difficult by the way) or you create a Live Template (see File | Settings | Editor | Live Templates | C# in Rider).