Forum rules - please read before posting.

[Issue] Checking CompVar from static asset: nothing happens if the check is true or false. No Warnin

Hi there!

Apologies for giving you so many headaches about CompVars, but I believe another unexpected behaviour is going on:

I enabled ALL logging options possible, even in AC. The console stays blank.

last dialogue never gets executed. Every variable has been correctly assigned. The first dialogue is just a placeholder.

For a second the asset actionlist executes, plays the first speech, then silently quits.

Always the same project triggering other issues (vase puzzle, checking a param compvar popup variable to be 0 "empty", to allow adding a vase only when it's empty).

Now each inventory interaction triggers (one for each vase size) the proper interaction with the proper settings (used Set Interaction Params 4 times, seems to work now, thanks to the hotfix)

Steps
1 create an asset actionlist
2 set a compvar parameter
3 pass the compvar parameter to the asset actionlist via Set Interaction params
4 create a hotspot with an inventory interaction using the above asset actionlist
5 properly configure the set interaction params
6 leave every optional params in the inventory interaction as blank
7 add a compvariable popup variable on the hotspot
8 add a compvariable check to the actionlist
9 the asset actionlist gets executed for a frame (enough to be shown for a fraction of a second in the debug box of AC. It quits silently OR (can't replicate it) says the variable doesn't exist, at runtime.

adding a dialogue before and after helped me to determine where the flow was stopping.

As reference, here's the full "Put a vase on pedestal" asset actionlist (there are a few errors and custom action down in the list, but they never get executed)

1 checks if the pedestal is empty by checking the compvar
2 if it's empty, checks which inventory vase has been used on the pedestal
3 an ugly yet functional if-then chain has been build to replicate a switch-like-syntax for inventory items
4 the player makes a dummy comment about the action
5 (missing from the image) all children components of the base of the pedestal GO get disabled
6 only the appropriate vase gets enabled back (yes, could be done using visibility, I'm testing a custom action)
7 the appropriate inventory item gets removed by the player's inventory

Also, if the interaction fails, I'm left with the inventory icon of the vase as a cursor.

Minor issue:
this asset interaction now works properly (checking the state of the pedestal via a Examine asset actionlist, checking for the popup compvar:

The issue is:
I believe it's 0 based (and running it works like it's zero based, but the labels on the nodes begin counting from 1.

Comments

  • Thanks for the steps, I will investigate.

  • For a second the asset actionlist executes, plays the first speech, then silently quits.

    In ActionVarCheck.cs, remove the lines 154-156:

    if (variableID == -1)
    {
        return GenerateStopActionEnd ();
    }
    

    I believe it's 0 based (and running it works like it's zero based, but the labels on the nodes begin counting from 1.

    Quite right, I shall amend this too.

  • edited August 2019

    In ActionVarCheck.cs, remove the lines 154-156:

    It worked! Thanks!

    but, got a warning about the Variable Component not existing (-1).

    Which is weird.

    What I did:

    1. I enabled debug mode in the inspector
    2. Manually changed the Set Interaction Parameter of the Component Variable from Reference Prefab to Reference Scene Instance.

    Also, went to the ActionList Asset in Debug mode and changed the parameter of the Component Variable to Reference Scene Instance.

    Now it seems to work fine... for some reason.
    The constantID of the pedestal (which holds the Component Variable) has been automatically assigned, set to Automatic, Retain in prefab OFF, ID 5146

    I guess some code may revert it to type: Prefab. So far, it's working with Reference Scene Instance as a workaround.

    • Chained non-issue 1: (but would be nice to have an extra placeholder field for listing the popup values to assign to a popup variable - not sure if it makes sense when using an ActionList Asset, but it sort of defies the purpose of using a popup field instead of just an integer)

    To set the Component Variable Type, since it's using placeholder, has to be done via an Int variable.

    Since Popup is basically an Enum, or, a set, or, a dictionary, why don't just call it "Enum" or remove it entirely and just use optional global-like Tables referenced by Name or ID, to be used optionally on each integer field? "isEnum" flag or "EnumID" as a dropdown defaulting to 0 - none, which, if set, it locks the Integer input field to just show the values in that EnumID ( I believe you're already working on something similar for the next major update)

    • Unrelated issue 2 (do you prefer opening a topic for each single one?):
      In the Editor, When dropping the inventory icon on the hotspot, it never switches back to an empty cursor (I only enabled the "test" cursor, but I'm actually only using it for testing purposes, the target is mobile, with no onscreen cursor)

      • Unrelated issue 3:

    I have a menu build like this (using AC system, placeholder GFX):

    WIth the InventoryBox set in this way:

    I have another menu"ShowInventory" with a single button to make it slide in, positioned on another more convenient place, and that arrow is a "back" button added straight into the inventory, to hide it.

    I have both inventory items and gameplay static icons in the inventory, such a diary, settings. And the vases, with placeholder GFX :P

    Only a certain amount of items can be shown at a time, so I added some buttons to scroll them (could be a temporary solution, I'm still not aware of how many objs the char could be carrying).

    The issue is:
    If the inventory is open, and I pickup a vase, the inventory needs a single refresh call to the layout, since currently it causes this kind of overlap:

    Closing and reopening the menu solves the issue (I believe it just needs to be invalidated or updated in some way)

  • but, got a warning about the Variable Component not existing (-1).

    What is the full error message, including the stacktrace, and what are the steps to reproduce it?

    would be nice to have an extra placeholder field for listing the popup values to assign to a popup variable

    You can assign an actual Popup Variable before overriding it as a parameter, to list "real" outputs.

    do you prefer opening a topic for each single one?

    Unrelated topics should go in new threads.

    In the Editor, When dropping the inventory icon on the hotspot, it never switches back to an empty cursor (I only enabled the "test" cursor, but I'm actually only using it for testing purposes, the target is mobile, with no onscreen cursor)

    What does it display, the inventory cursor? Please share your Settings and Cursor Managers in a fresh thread.

    If the inventory is open, and I pickup a vase, the inventory needs a single refresh call to the layout, since currently it causes this kind of overlap:

    Open up PlayerMenus.cs and replace the ResetInventoryBoxes function (around line 2666) with the following:

    public static void ResetInventoryBoxes ()
    {
        if (KickStarter.playerMenus)
        {
            for (int i=0; i<KickStarter.playerMenus.menus.Count; i++)
            {
                Menu menu = KickStarter.playerMenus.menus[i];
                bool update = false;
                for (int j=0; j<menu.elements.Count; j++)
                {
                    if (menu.elements[j] is MenuInventoryBox)
                    {
                        update = true;
                    }
                }
                if (update)
                {
                    menu.ResetVisibleElements ();
                }
            }
    
            for (int i=0; i<KickStarter.playerMenus.customMenus.Count; i++)
            {
                Menu menu = KickStarter.playerMenus.customMenus[i];
                bool update = false;
                for (int j=0; j<menu.elements.Count; j++)
                {
                    if (menu.elements[j] is MenuInventoryBox)
                    {
                        update = true;
                    }
                }
                if (update)
                {
                    menu.ResetVisibleElements ();
                }
            }
        }
    }
    

    Does that resolve the issue?

  • edited August 2019

    Does that resolve the issue?

    Unfortunately, it didn't :/

    Yes, that was pretty obvious I had to use different topics, I tried to mix them since they were all sharing the same assets/ configurations/ steps used in other topics I opened.

    I'm not sure I'm going to be able to reproduce all of them, or to understand what is involved.
    For some, I managed to solve the issue by pure chance (such as in the "change Prefab to Instance in scene" case)

    I always have the same assets/actions/CompVars, using the same settings.

    Yet, I can only drag and drop the small and normal vase, but not big one. And... they are identical even in debug mode.

    Component Variables get correctly passed, checked and stored only if in debug mode I set them to "Instance in scene". Some native script is setting Set Interaction Parameters to reference a "Prefab", and they stop working if they're set like that.

    What does it display, the inventory cursor? Please share your Settings and Cursor Managers in a fresh thread.

    I will. I can anticipate that: if the interaction is set to "single click" (global settings are: first select hotspot, then action), the in-editor cursor stays like the appropriate icon for that interaction, even after the interaction ended.

    Instead, if I drag and drop an item to an hotspot, the cursor stays like that of that inventory Icon.

    Also, if I set an interaction like: "grab the vase", (click on hotspot->click "Examine"), and the examine interaction triggers this interaction:

    The head of the character glitches for a second (I set the correct bones in the Player component) and tweens back to looking forward. I believe it's because I checked "Play in background" and also the Actionlist Asset is set to "Run in background".

    If I uncheck the "Play in background" in the Action, the head twists correctly while the text is displayed.

    I guess I should probably check "don't animate speaker".

    Yet, shouldn't the head/eyes bones be left untouched if the Speech action is instantaneous, without having to check 2 checkboxes?

    I recorded a 7-8 mins video that I can't publicly share (under NDA, and it's not just a few screens), browsing through the above issues.

    It's a mute video (I can't talk where I currently am), but should give a more explicit overview of the above issues.

    I'm sending it via PM (it's a GDrive shared video link, there's no need to download it, it can be streamed and skipped at will). Yes, a silent video is boring, I know. I felt a bit like an idiot by making gestures in circles with the mouse :D

    In the meantime I'm going to take some time and open different topics, but it's going to take a lot more time to describe each of the issues in full formality in BugReport Ticket style 😅
    In the vid I'm showing about 4 of the above issues and browsing through settings and interactions, also in play mode and inspecting in debug mode.

    The issue with the not-updated inventory also happens when removing an item. In the middle of an interaction.

    Hope it helps!

  • edited August 2019

    Please let me recap here lots of shared settings:

    Settings Manager:



    Inventory Manager:

    Small Vase Inventory Item:

    Medium Vase Inventory Item:

    Big Vase Inventory Item:

    Custom Inventory Properties (currently barely used)

    Speech Manager

    Cursor Manager

    Menu Manager

    Inventory Menu




    Close Inventory Click Action

    Show Inventory Menu

    Show Inventory Click Action

    Left Pedestal gameobject: Hierarchy

    Left Pedestal gameobject: Inspector


    Set Interaction Parameters: Use

    Set Interaction Parameters: Inventory

    ActionList asset: PoggiaVaso (trad: PlaceVase)
    Please note that the visual showing/hiding of the proper vase is still WIP, I need to tweak a few custom actions

    Is there any other setting/Actionlist shared between the issues that could help you in sorting out a few of them?

  • Again, please share the full error message from the Console related to the variable parameter issue.

    Yet, I can only drag and drop the small and normal vase, but not big one. And... they are identical even in debug mode.

    Your third vase has its "Examine" ActionList assigned in its Use interaction slot.

    if I drag and drop an item to an hotspot, the cursor stays like that of that inventory Icon.

    This is because you are using Hardware rendering for the cursor, but no main cursor graphic is assigned - so there's nothing for the cursor to be re-assigned to once the inventory has been deselected.

    While you should use Software rendering for touch-screen devices, you could try setting the main cursor to display always, but assign a transparent texture.

    The issue with the not-updated inventory also happens when removing an item. In the middle of an interaction.

    Recreated, will work on a fix. In the meantime, set the InventoryBox element's When slot is empty field to Clear Content.

    The head of the character glitches for a second

    Are you moving the trophy instantly when the interaction runs? I suspect the player's head is turning towards wherever you've placed it. Hiding the trophy through animation states would prevent this.

  • edited August 2019

    Your third vase has its "Examine" ActionList assigned in its Use interaction slot.

    Oh my, I totally missed that! thank you!

    This is because you are using Hardware rendering for the cursor, but no main cursor graphic is assigned - so there's nothing for the cursor to be re-assigned to once the inventory has been deselected. While you should use Software rendering for touch-screen devices, you could try setting the main cursor to display always, but assign a transparent texture.

    Will use that workaround, thank you :)
    yet, even at low priority, I'd love if this tiny issue was handled by the engine itself.
    I assume it should require a few more checks (checking for null default cursor) to restore the cursor like it was in the editor right before it got permanently switched to something else.

    Recreated, will work on a fix. In the meantime, set the InventoryBox element's When slot is empty field to Clear Content.

    That's great news! :)
    Sure, will do. Currently it's set to Disable Object.

    Are you moving the trophy instantly when the interaction runs? I suspect the player's head is turning towards wherever you've placed it. Hiding the trophy through animation states would prevent this.

    Nope. Actually, I'm completely removing it (and his hotspot):

    I guess that when the dialogue is set to "Play in background", the looktarget/hotspot becomes null at some point.

    The expected behaviour would be the character to slowly ease back to front view tho (maybe deselecting the hotspot, which is nested inside the object).
    Yes, probably it would be just better to hide it an disable the hotspot, I was doing it the quick and dirty way... and discovered a little glitch :)

    (I should also be adding an animation to run in parallel: the action above is not set in stone. Yet, it felt a bit weird :) )

  • edited August 2019

    With the inventory issue, try again with my suggested replacement for "ResetInventoryBoxes" but replace:

    menu.ResetVisibleElements ();
    

    with:

    menu.Recalculate ();
    

    I guess that when the dialogue is set to "Play in background", the looktarget/hotspot becomes null at some point.

    I don't think it's related to the dialogue. When a Hotspot interation is run, the character's head look-at target is cleared if they were looking at that target, but it's not an instant snap. It looks like your own character is looking somewhere else, before the expected behaviour of resetting.

    Are you using Unity's IK system for head-turning? If so, and you enable gizmos in the Game window, a red wireframe sphere should point to where he's looking.

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.