IsaacMulcahy / RPG-AI-SYSTEM-WIKI

A wiki which covers how the RPG-AI-SYSTEM works and how to customize it
5 stars 0 forks source link

BUG - Import error (Unity 2021 - 2022) #2

Closed GamePowerDev closed 2 years ago

GamePowerDev commented 2 years ago

Describe the bug

When importing the asset into a new project, the following errors show up. 2022-10-09 (2)

Assets\CIVIL-AI-SYSTEM\Script\Menu\FlowchartEditor\Nodes\Node.cs(32,16): error CS0177: The out parameter 'actualID' must be assigned to before control leaves the current method

Assets\CIVIL-AI-SYSTEM\Script\Menu\FlowchartEditor\Nodes\Node.cs(35,22): error CS0269: Use of unassigned out parameter 'actualID'

To Reproduce Steps to reproduce the behavior:

  1. Import the asset from the asset store
  2. See error

Expected behavior There should be no errors upon importing

Screenshots 2022-10-09 (2)

IsaacMulcahy commented 2 years ago

Hi GamePowerDev, thanks for buying the product and sorry about you running into this issue. I've been taking a look at it and it does seem odd.

There seems to be a few issues related to how 'Unity Packages' works and how I've done this package which will need some more time to fix, however I have found a hotfix solution which seems to solve most of the issues. If within the 'Node' object class you replace the constructor (line 32-46) with the following it should work...

public Node(Vector2 mousePosition, string setNodeType, out Guid actualID)
        {
            actualID = Guid.Empty;
            id = idCount;
            itemId = actualID;
            idCount++;

            uiConnections = new List<FlowchartConnection>();
            nodeType = setNodeType;

            orderWidget = (OrderWidget)ScriptableObject.CreateInstance("OrderWidget");
            orderWidget.Setup(this);

            Create(mousePosition);
}

Another issue which you'll run into is with the example scene, this is down to all the 'resources' and 'civil' objects losing their 'layers' (unity packages doesn't include these). Best thing to do for now is to create a 'Civil' and a 'Resource' layer and assign the following assets to them (do not include children)...

Civil

Resource

A larger fix will be released following on from this which will improve this process. Any more issues I'm more than happy to help out with.

GamePowerDev commented 2 years ago

That hotfix worked for me! And no problem, I'm happy to help squash any lingering bugs! I'll be testing over the next few days!

IsaacMulcahy commented 2 years ago

Thanks for being so cool about it. I've just updated the package on Unity so after it goes through Unity internal systems it should be fixed (hopefully before the end of this working week)

IsaacMulcahy commented 2 years ago

Released new build with fix (v0.1.1)