• Hi Guest!

    We have posted a new VaM2 dev log on Patreon, starting a monthly cadence of written progress updates between Beta releases. Highlights include the new Gizmos System, Selection Carousel, and Modes System with Context-Specific Editing. Beta1.2 is 15 of 21 items complete.

    Read the full post on Patreon, or follow progress on the public Trello roadmap.

Solved [SCRIPTING] Does anybody know the code/script to add a script to an Atom using a script?

whymeazn

New member
Joined
Sep 27, 2020
Messages
7
Reactions
0
So say I create Atom AudioSource using code, and I add it to the scene. How does one attach a script to this AudioSource to it, such as soundRandomizer.cs into it, via using it scripts? What is the code/syntax for it?
 
Solution
Never tried this, but some bits as a starting point to dig into. Remember, you can look at VaMs codebase with ILSpy to figure out the details:
  • Every atom has a JSONStorable named "PluginManager", which should be a MVRPluginManager object.
  • Calling CreatePlugin() on the MVRPluginManager should give you a MVRPlugin object.
  • Setting plugin.pluginURLJSON.val = "Custom/Scripts/YourFancyPluginHere.cs"; should cause the plugin to be compiled and loaded.
Never tried this, but some bits as a starting point to dig into. Remember, you can look at VaMs codebase with ILSpy to figure out the details:
  • Every atom has a JSONStorable named "PluginManager", which should be a MVRPluginManager object.
  • Calling CreatePlugin() on the MVRPluginManager should give you a MVRPlugin object.
  • Setting plugin.pluginURLJSON.val = "Custom/Scripts/YourFancyPluginHere.cs"; should cause the plugin to be compiled and loaded.
 
Upvote 0
Solution
Ah I see, I think I have a better understanding now - also one example I've seen used is AutoMate when it automatically loads plugins to the Person Atom or Session on load.
 
Upvote 0
Back
Top Bottom