Closed Vedrina closed 1 year ago
Really cool idea! It's not supported at the moment, but I already made initial working solution. Now I'm trying to make it possible to pass any objects suitable for the inspector with the method, like a popup of the filtered Transforms from the child objects 🤔
It may take a few days, since I'm on a vacation, but I really eager to make this improvement
@Vedrina I made this change. I will improve it a little bit later on, but it is pretty useful as it is.
Try the Update button in the MyBox Window. It won't show that there is a new version, but will grab the latest changes anyway.
For now, it is possible to use only with the methods returning arrays, so in your method simply put wordsDictionary.animalsWords.ToArray()
at the end and change return type to string[]
.
[DefinedValues(nameof(GetNames))] public string name;
should do just fine.
The code I used to test this new feature:
[DefinedValues(nameof(StringTest))]
public string TestStrMethodPopup1;
[DefinedValues("Hello", "World")]
public string TestStrPopup2;
[DefinedValues(.5f, 1f, 1.5f, 2f)]
public float TestFloatPopup;
[DefinedValues(nameof(TransformTest))]
public Transform TestTrMethodPopup;
private string[] StringTest() => new[] { "A", "B", "C" };
private Transform[] TransformTest()
{
var childs = transform.GetChilds();
childs.Insert(0, null);
return childs.ToArray();
}
My god you are fast. Thank you!
Hi, I'm not sure if this is possible already, but I've used TriInspector before and used my code like this:
In here I wanted to get a dropdown of strings which were returned as a list from other scriptable object. In WordsDictionary.cs i have public animalsWords which have been read from json file, and it was serialized beforehand.
Just to conclude, I want dropdown of List names which would be generated from json file in the editor.
Is something like this possible in Mybox?
Thank you upfront!