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

whymeazn

New member
Messages
8
Reactions
0
Points
1
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?
 
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
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