• Happy Holidays Guest!

    We want to announce that we will be working at reduced staffing for the holidays. Specifically Monday the 23rd until Jan 2nd.

    This will affect approval queue times and responses to support tickets. Please adjust your plans accordingly and enjoy yourselves this holiday season!

  • Hi Guest!

    Please be aware that we have released a critical security patch for VaM. We strongly recommend updating to version 1.22.0.7 using the VaM_Updater found in your installation folder.

    Details about the security patch can be found here.

Is there a plugin developer guide?

geo_gan

Active member
Messages
111
Reactions
34
Points
28
Is there a plugin developer guide or something like that anywhere?

Like what environment to use?

What language? Is it basically C# in Unity?

What is API and datastructures that can be used?

I want to develop simple plugin for VAM but not sure where to start.
 
Last edited:
Unfortunately there is not a single guide out there.

Some recommendations and notes

Top way I started is to read other authors code, ideally something on the simpler side depending on your comfort level at the beginning. The Start, Update, FixedUpdate functions in plugins are good places to start the learnings.

Unity MonoBehavior docs can help you understand the basic plugin live-cycle.

VaM has blocked some includes like Reflection, file IO, and some networking.

Get a good object browser and decompiler like ILSpy if you need to explore code in the VaM DLLs that are in Vam_data
 
This template might help you out as well.
[/URL]

Thanks for all that info. That was all a lot of help in jumping me forward a good bit. I was actually just going to edit the *.cs file in a text editor. Didn't realise it needs to be compiled at all. As far as I know, when this is released to VAM users as a plugin, all they get is the single .cs text file isn't it?
I presume all this debugging and compiling is just to emulate what happens when VAM runs the plugin, is it?
Also, is there no "compile" option inside Visual Studio Code instead of having to open CMD and doing "dotnet build" as the help text says to do to test it?
 
Thanks for all that info. That was all a lot of help in jumping me forward a good bit. I was actually just going to edit the *.cs file in a text editor. Didn't realise it needs to be compiled at all. As far as I know, when this is released to VAM users as a plugin, all they get is the single .cs text file isn't it?
I presume all this debugging and compiling is just to emulate what happens when VAM runs the plugin, is it?
Also, is there no "compile" option inside Visual Studio Code instead of having to open CMD and doing "dotnet build" as the help text says to do to test it?

The code will not need to be compiled. Just open the cs file in VaM and VaM will compile it yes.

Best use of a good IDE like VSCode will be
- autocomplete just to help you while you discover the APIs
- show you any syntax errors in red
- nice way to jump around functions and look at functions in the VaM api.

Debugging with breakpoints will not work in IDE for this VaM plugin things tho.

If you ever want to have a multiple file plugin you will have make a “cslist” file. That file has the relative paths to files listed. Then in VaM you open cslist file instead of the cs file.

One reason for multiple files is just for organization for yourself.

Another reason is VaM compiler will blow up if one file is over about 1000 lines long.

Best examples of cslist files are larger plugins. Acidbubble Timeline, LFE Keyboard Shortcut, or MacGruber Effects plugins are big.
 
There is some API I can see? Is it documented?

It is not documented, unfortunately. The best way I have explored it is with pure trial and error, looking at other peoples code, and asking questions in the #plugins and #scripting channels in the official Discord.

I tend to right click on some code in VS Code and browse to the definition and just read public methods.

vs_code_definitions.png


vs_code.png


The API is really not documented at all.

VS Code is pretty well documented tho and getting it to work with c# projects is best started with some template like Acidbubbles plugin template or something like that.
 
It is not documented, unfortunately. The best way I have explored it is with pure trial and error, looking at other peoples code, and asking questions in the #plugins and #scripting channels in the official Discord.

I tend to right click on some code in VS Code and browse to the definition and just read public methods.

View attachment 2738

View attachment 2739

The API is really not documented at all.

VS Code is pretty well documented tho and getting it to work with c# projects is best started with some template like Acidbubbles plugin template or something like that.

Cheers for the info. I'd say I have a bit of a learning curve. But I am used to this kind of thing, being a professional software developer.
 
I tend to right click on some code in VS Code and browse to the definition and just read public methods.

I am also a coder, but I dont do VStudio(its license engine hates me), I'm a big fan of JetBrains IDE developers, I use IDEA from them, and found out they have a Jetbrains 'Rider' IDE, for C#/Net stuff, it works too, used it to make my first plugin .cs (I totally ripped the guts out of compliance and searched in other plugins for keywords (PositionComply,etc)).

My problem is, and I assumed the VS people wouldnt experience this problem, but the objects backing my .cs dont seem to be loaded (I just open random .cs, so no autocomplete OR ability to dive deeper in code) ...... I was hoping maybe someone reading this might know what I need to add to get that dependency properly linked? I can figure out where it would be in Rider, but I just dont know what to look for, Unity libs? Vam source? TIA.. also interesting post. My background is 'brand spankin new' for Unity stuff, but I coded with many other SDKs and languages, I mostly dont know where the knobs are yet....

I know I dont need to tell anyone the documentation situation is dire, we all agree its not plentiful or very accessible, but a while back I made my own free wiki from some free wiki place, (added URL to My profile's Status instead of here), I know some of the answers to these questions now too so I will endeavor to assist in documenting the components I discover.
 
Last edited:
I am also a coder, but I dont do VStudio(its license engine hates me), I'm a big fan of JetBrains IDE developers, I use IDEA from them, and found out they have a Jetbrains 'Rider' IDE, for C#/Net stuff, it works too, used it to make my first plugin .cs (I totally ripped the guts out of compliance and searched in other plugins for keywords (PositionComply,etc)).

My problem is, and I assumed the VS people wouldnt experience this problem, but the objects backing my .cs dont seem to be loaded (I just open random .cs, so no autocomplete OR ability to dive deeper in code) ...... I was hoping maybe someone reading this might know what I need to add to get that dependency properly linked? I can figure out where it would be in Rider, but I just dont know what to look for, Unity libs? Vam source? TIA.. also interesting post. My background is 'brand spankin new' for Unity stuff, but I coded with many other SDKs and languages, I mostly dont know where the knobs are yet....

I know I dont need to tell anyone the documentation situation is dire, we all agree its not plentiful or very accessible, but a while back I made my own free wiki from some free wiki place, (added URL to My profile's Status instead of here), I know some of the answers to these questions now too so I will endeavor to assist in documenting the components I discover.

I have never used IDEA. I use VS Code most of the time. The trick to autocomplete is for your IDE to recognize .csproj files AND for that file to be referencing the proper relative location of the unity and vam DLLS.

AcidBubbles has a good plugin template that I recommend. https://github.com/acidbubbles/vam-plugin-template

Make sure to open up the csproj file. You will see stuff in there like

Code:
    <Reference Include="UnityEngine.VRModule">
      <HintPath>..\..\..\..\VaM_Data\Managed\UnityEngine.VRModule.dll</HintPath>
    </Reference>
    <Reference Include="UnityEngine.XRModule">
      <HintPath>..\..\..\..\VaM_Data\Managed\UnityEngine.XRModule.dll</HintPath>
    </Reference>

Make sure that wherever you have your plugin folder that you are developing with can actually see those paths. Notice how there are four up-a-folder thingies. Just make sure those all look alright.

I usually have a folder structure like this:

VAM/Custom/Scripts/Dev/MyProject/Whatever.cs

This is nice for me because my dev stuff is separate from the installed stuff and it always has the right up-a-folder-ness if I copy and paste the template into a new project.
 
I have never used IDEA. I use VS Code most of the time. The trick to autocomplete is for your IDE to recognize .csproj files AND for that file to be referencing the proper relative location of the unity and vam DLLS.

AcidBubbles has a good plugin template that I recommend. https://github.com/acidbubbles/vam-plugin-template

Make sure to open up the csproj file. You will see stuff in there like

Code:
    <Reference Include="UnityEngine.VRModule">
      <HintPath>..\..\..\..\VaM_Data\Managed\UnityEngine.VRModule.dll</HintPath>
    </Reference>
    <Reference Include="UnityEngine.XRModule">
      <HintPath>..\..\..\..\VaM_Data\Managed\UnityEngine.XRModule.dll</HintPath>
    </Reference>

Make sure that wherever you have your plugin folder that you are developing with can actually see those paths. Notice how there are four up-a-folder thingies. Just make sure those all look alright.

I usually have a folder structure like this:

VAM/Custom/Scripts/Dev/MyProject/Whatever.cs

This is nice for me because my dev stuff is separate from the installed stuff and it always has the right up-a-folder-ness if I copy and paste the template into a new project.

Thank you very much for this info, I am looking at this and the references within and I think you are correct, this will probably work for what I need! Much appreciated! :)

update: IT WORKS!! Autocomplete and Definition lookups for the win! Many Thanks!
 
Last edited:
It is not documented, unfortunately. The best way I have explored it is with pure trial and error, looking at other peoples code, and asking questions in the #plugins and #scripting channels in the official Discord.

I tend to right click on some code in VS Code and browse to the definition and just read public methods.

View attachment 2738

View attachment 2739

The API is really not documented at all.

VS Code is pretty well documented tho and getting it to work with c# projects is best started with some template like Acidbubbles plugin template or something like that.
I've tried everything I could think of to get code browsing to work (on both VS2019 and latest VSCode) and no dice.

This is of course on top of Acid Bubble's awesome starter template (and after fixing the path to VaM in the .csproj file)

Has anyone been able to get code browsing to work?
Q1: In which IDE (VS or VSCode?)
Q2: On top of Acid Bubble's template or differently?
Q3: I see a little warning icon next the the VaM libraries in Visual Studio but no way to fix the error loading them.. I assume it doesn't work in VS for that reason... Is there a step I'm missing?

Thanks so much! I reaaaaaally need code browsing to work given the lack of API documentation!

JP
 
Update: I was finally able to browse the VaM codebase through IL (Intermediate language) by download ILSpy and loading the 'Assembly-CSharp.dll' file in a VAM_Data subfolder. (I wished I could still use VSCode or VS to traverse to the code I need in the IDE but at least with ILSpy I can access more (and even much of the VaM source code!) Recommended!
1639864772945.png
 
I'm using Rider, which has built-in decompiling, so I can open the code for VaM methods right in the IDE. I've used vscode for a long time too though, it's also excellent, and in both cases if your paths are right it should work. Also, you can test using .NET 6 (or .NET Core 3.1 and more recent really) with `dotnet build` to quickly test your setup and fix errors, it's easier then finding the error from IDE logs.
 
Thanks for the tip Acid Bubbles! (And thanks for your pioneering work writing quality VaM scripts!) I'll switch to Rider right away. (I've used JetBrains IntelliJ for years and I'm glad to hear Rider offers something over Visual Studio)

Q1: Is there any possibility of debugging scripts? (I've debugged Unity projects for years using the Visual Studio Unity debugger and am wondering if scripts compiled by VaM can be debugged the way I used to debug my Unity games)
Q2: If #1 is a 'no', can I somehow debug my scripts by loading some Unity version of VaM?

Thanks for the awesomeness!
 
Update: Holy crap is that Rider for Unity video impressive! Brilliant minds at JetBrains created an incredibly powerful tool! I'm *definitively* purchasing Rider for my work on advanced VaM scripts. Thanks to Acid Bubbles for the heads up.

What this video! https://www.jetbrains.com/lp/dotnet-unity/
 
I'm using Rider, which has built-in decompiling, so I can open the code for VaM methods right in the IDE. I've used vscode for a long time too though, it's also excellent, and in both cases if your paths are right it should work. Also, you can test using .NET 6 (or .NET Core 3.1 and more recent really) with `dotnet build` to quickly test your setup and fix errors, it's easier then finding the error from IDE logs.
I know this is an old thread - but I was wondering Acid Bubbles; do you still use Rider, and does it let you breakpoint and step through the code?
 
I know this is an old thread - but I was wondering Acid Bubbles; do you still use Rider, and does it let you breakpoint and step through the code?

I was happy with Visual Studio Code pointing a reference in the C# "csproj" file at the decompiled VAM source code (using ILSPY). This let me have code completion and use F12 to jump through symbols.

Mostly liked it b/c it was free. I'll bet some of the paid tools are much better but having code completion and symbol navigation for free was good enough for me.
 
I was happy with Visual Studio Code pointing a reference in the C# "csproj" file at the decompiled VAM source code (using ILSPY). This let me have code completion and use F12 to jump through symbols.

Mostly liked it b/c it was free. I'll bet some of the paid tools are much better but having code completion and symbol navigation for free was good enough for me.

Wait - could you explain in a little more detail for dummies how you set that up? You used ILSpy to decompile the whole vam source code somewhere and then edited the csproj file so that VS code would look to the decompiled sources to give you eg Intellisense hints that also included references to the decompiled sources?

Or smth?
 
Hi @Case. I am really sorry but I have forgotten exactly what I did. My computer crashed a while back and I have yet to set up a VAM development environment again.

I did some searching and saw some omnisharp decompile stuff option omnisharp.enableDecompilationSupport, which is new to me. You might want to try that.


I do know at least one thing of many that I did. Pointed the .csproj file at the VAM DLLs using a relative path to my coding folder. This was what gave me autocomplete. You can see examples in any of the csproj files on my github and it is this section that matters.

<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\VaM_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
 
Hi @Case. I am really sorry but I have forgotten exactly what I did. My computer crashed a while back and I have yet to set up a VAM development environment again.

I did some searching and saw some omnisharp decompile stuff option omnisharp.enableDecompilationSupport, which is new to me. You might want to try that.


I do know at least one thing of many that I did. Pointed the .csproj file at the VAM DLLs using a relative path to my coding folder. This was what gave me autocomplete. You can see examples in any of the csproj files on my github and it is this section that matters.

Ok, thx, I'll look into the Omnisharp thingy - though, tbh, I mainly use the VSCode editor as a json-editor & try to set up Visual Studio for plugin-tinkering.

i use Visual Studio (not visual studio code)

start a new project Class Library (.Net Framework 3.5)

in References right click and and add reference, pick all dlls in \VaM_Data\Managed except for System*.dll and mscorlib.dll (you probably don't need all, maybe just Assembly-Csharp & Unity*)

View attachment 201493

and you should now have autocomplete and references, like if you ctrl-click on a function

VS shortcuts are very weird, you'll probably want to change those: Options > Keyboard > scheme pick Visual Studio Code

other than that you should be good to go. if you also want to compile it as a dll, remove everything in Properties > AssemblyInfo.cs


And then I can use the new Project Class Library as a template instead of moving .cs files into Meshed's PluginBuilder.sln?
Nice!

Thanks a bunch!
 
Back
Top Bottom