Forum rules - please read before posting.

Suggestion: More specific ToString() overrides

edited January 2023 in Technical Q&A

Here's a suggestion for a small quiality-of-life feature I always missed in AC:

It would be helpful to have a bit more specific ToString() values for Hotspot, InvItem, Objective, AC_Char and whatever else.
For example, it would be nice to see the name of the hotspot when hovering over a Hotspot instance without having to drill down further in the debugger 👍

Comments

  • Hovering over where - the Inspector?

    Example code of what you're looking for would be welcome.

  • I mean when hovering over a for example a hotspot in a code editor's debugger (such as VS or VS Code or similar). They all use ToString() or the DebuggerDisplay attribute for this:
    https://stackoverflow.com/questions/3190987/c-sharp-debugging-debuggerdisplay-or-tostring

  • Sorry, but I will need more clarification. When I test this in VS, the header lists both the object's type, and GameObject name.

    Are you looking to replace this with the "in-game" name, i.e. the character's speaker label, if set?

  • No worries - yes, that's what I mean. So when hovering over an item in the debugger, it's a little more practical if the debugger shows something like option B rather than option A:

    A: AC.TextLine
    B: LineId 123: "I'm Guybrush Threepwood, and I'm a mighty pirate!"

    It's just a small thing, but I often thought it a bit surprising that I have to drill down in the debugger just to get some basic info on an instance. I imagine this would be beneficial to you most of all :)

    Here's a bit more info on the practice (it doesn't mention the DebuggerDisplay which also works):
    https://www.codeguru.com/dotnet/why-overriding-tostring-is-a-good-idea/

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.