Getting started with custom script GUI? [Edit: Solved]

voidkampf1984

Member
Featured Contributor
Messages
16
Reactions
71
Points
13
Patreon
7th7andwich
Edit: Tl;Dr I took a look at the sample files provided by MeshedVr. It's all a lot more simple than it looks.

Hi sorry if this has been asked before but I am at a loss & have spent a few days trying different searches...

I have a pretty good knowledge of unity, c# etc... but I'm not finding any answers.

Do I just use attributes?
Custom editor window?
Build a unity gui window?

I have unpacked an older version of Acidbubble's glance plugin... is there some sort of UI builder tool I don't know about? This looks like generated UI code?

I kind of know what json is but haven't worked with it before.

Any tips on where to get started? I'm watching some intro to JSON stuff on youtube at the moment.

I could theoretically spend a day or two reverse engineering this to start copy pasting together a basic UI... but something tells me that I might be completely misunderstanding the work flow. 😅

If anyone can help me wrap my head around this, I'll be able to put together some scripting tutorials.

I just need to learn the basics to get started, slider bar, color picker, etc.
 

Attachments

  • image_2021-04-05_195503.png
    image_2021-04-05_195503.png
    85.9 KB · Views: 0
Last edited:
For future readers, the basic UI setup is straightforward:

C#:
// Here we create a "storable", a value that can be set and can callback when the value is changed.
// It will be visible in triggers and saved as MyStorableName, have an initial value of 0.5f, and can
// be changed to values within 0 and 1.
// The are other storable types (strings, bools, and actions)
var myStorableJSON = new JSONStorableFloat("MyStorableName", 0.5f, SyncMyStorable, 0f, 1f);
// This will make the storable visible to triggers, and this will also save it along with your scene.
RegisterFloat(myStorableJSON);
// This will create a slider in the plugin's custom UI, false means left and true means right.
CreateSlider(myStorableJSON, false);

If you want storables to save with the look, scene, appearance etc, see this excellent guide by @JayJayWon https://hub.virtamate.com/resources/preset-definitions.189/
 
You might want to checkout MacGruber_Utils.cs which ships with many of my plugins. It wraps away the things you need to do in some static functions and also provides additional UI elements beyond what VaM offers on its own. Most recent version currently comes with IdlePoser, although better usage examples are probably with LogicBricks.
 
Thank you both, very helpful tips. Very much appreciated!
I think I'm starting to get my head around the system.
Once I feel confident enough in my understanding I'll try and put a beginner's tutorial video together.
 
Back
Top Bottom