legendaf•

There is a TON here to digest. I always love seeing others perspectives on how they solve different issues.

Thank you for open sourcing this and sharing with the community. I am going to go dig in now.

I think that Player Profiles will be an immediate help for us as we are currently building something similar out.

2
TASagentOP•

Awesome, I'm glad to hear it.

Some elements of how the Player profiles interacts with the Default profile are motivated by its use in designing and running psychology experiments. Specifically, accessing the Settings after booting up the application but before logging into a user shows you the settings of the Default profile. Any settings instantiated with pushOnCopy set to true will be copied into new profiles from the default profile when they're created, whereas settings with that value set to false will revert to the default value.

Viewing the default profile is also handy in development because that's the profile that's active if you dive right into a scene without going through proper initialization (IE, you're in a scene in the editor).

2
SilentSin26Animancer, InspectorGadgets, Weaver, UltEvents :redditgold:•

We have built a fairly robust and powerful programmatic StateMachine

I would never call a system that relies on magic strings "robust".

If you don't need it... figure out a way to need it. Math is great.

You must be the guy who has to come up with problems for math textbooks. :)

Edit: tpyos

heh.

1
TASagentOP•

I would never call a system that relies on magic strings "robust".

If you utilize it with magic strings, you deserve what you get. Using references to a few clearly-named const strings is kind of the opposite of what's meant when one talks about magic strings. But I get what you mean, I generally prefer enumerations for that sort of thing.

You must be the guy who has to come up with problems for math textbooks. :)

Well, I did go to grad school to get my PhD in computational physics... Does that address your speculation?

1
SilentSin26Animancer, InspectorGadgets, Weaver, UltEvents :redditgold:•

Using references to a few clearly-named const strings is kind of the opposite of what's meant when one talks about magic strings.

Even then, it's still a situation where any string could get used. For example, if you want to set up something up in the inspector the best security you could get would be if you created a custom property drawer to use a dropdown menu to only pick from those strings. But even then if you change one of the strings all your serialized data is useless. Compare that to an enum which automatically gets the dropdown menu, only has serialization issues if you reorder elements, and is more efficient all around.

But I get what you mean, I generally prefer enumerations for that sort of thing.

That's pretty much my point. I only had a quick glance at it, but it looks like you could just turn it into a generic class to use any type of key instead of only strings without much effort. I also use a generic state type in my state machine system. You can always make a class StateMachine : StateMachine<string, State> as the default for if you do want to use strings for whatever reason, but there doesn't seem to be any reason to restrict the functionality to only strings.

1
TASagentOP•

Yeah, I believe the author originally wrote it with strings because it was written to replace some place where he was using Unity's animation state machine, so he gave it the same interface, wherein you invoke triggers with their string names. Since Unity finally allows the use of more modern C#, it would be possibly to enforce the template argument be an enum and just tell the people who want to use strings to get fucked.

1