Forum rules - please read before posting.

Bug? Speech.cs does not compile

There are four compile errors in Speech.cs. All of them apply to a constructor of private struct RichTextTag, that is defined at like 1471.

When I try to compile the project in MonoDevelop, I get the following errors:

Assets\AdventureCreator\Scripts\Speech\Speech.cs(1475,6,1475,20): error CS0188: The 'this' object cannot be used before all of its fields are assigned to

Assets\AdventureCreator\Scripts\Speech\Speech.cs(1471,11,1471,22): error CS0843: Backing field for automatically implemented property 'AC.Speech.RichTextTag.openTag' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer.

Assets\AdventureCreator\Scripts\Speech\Speech.cs(1471,11,1471,22): error CS0843: Backing field for automatically implemented property 'AC.Speech.RichTextTag.closeTag' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer.

Assets\AdventureCreator\Scripts\Speech\Speech.cs(1471,11,1471,22): error CS0843: Backing field for automatically implemented property 'AC.Speech.RichTextTag.usesParameters' must be fully assigned before control is returned to the caller. Consider calling the default constructor from a constructor initializer.

No matter what I do I can't get rid of this mysterious error. I re-imported all the scripts from Adventure Studio, I made Unity rebuild its "Library" subdirectory, no change.

AC version is 1.67.5
Unity 2018.2.11f1

Comments

  • I can't recreate such errors. What platform are you working on?

    Instead of compiling directly in MonoDevelop, what occurs in Unity? Do the errors show in Unity? When building, or at all times?

    Open up Speech.cs, and replace line 1498:

    public RichTextTagInstance (string _openText, string _closeText, int _startIndex)
    

    with:

    public RichTextTagInstance (string _openText, string _closeText, int _startIndex) : this()
    

    And line 1507:

    public RichTextTagInstance (RichTextTagInstance instance, int _endIndex)
    

    with:

    public RichTextTagInstance (RichTextTagInstance instance, int _endIndex) : this()
    

    Does that allow compilation?

  • Hello,

    I replaced those lines, but no change. Same errors.

    However, if I replace those lines (1466-1468:
    public string openTag { get; private set; }
    public string closeTag { get; private set; }
    public bool usesParameters { get; private set; }
    with:
    public string openTag;
    public string closeTag;
    public bool usesParameters;

    the mysterious errors disappear and the entire project compiles fine. So, can I leave it like that?

    My platform is Windows 10 build 17134, x64 with AMD Ryzen5 2400G.
    Unity 2018.2.11f1
    MonoDevelop-Unity, version 5.9.6

    Curious thing, in Unity entire project works fine. But when I want to modify one of my scripts, it sends me to MonoDevelope editor, I compile the project and then it throws errors. Nevertheless, when I start the project in Unity, it works fine.

    How does it do it, I have no idea.

  • edited May 1

    the mysterious errors disappear and the entire project compiles fine. So, can I leave it like that?

    Yes, I'll make the same change officially as well. Thanks for the feedback.

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.
Do NOT follow this link or you will be banned from the site!