Forum rules - please read before posting.

Custom script error upon updating

edited April 2021 in Technical Q&A

Hi there,

I seem to have a habit of disappearing for 4 months and then coming back and updating and facing script problems... lol

Is anyone here able to help me? I tried looking on the script guide for alternatives but I'm kinda dumb and couldn't find anything...

The problem is something that I got from here, it was a remove all in category for inventory

But I now get

error CS1061: Type AC.RuntimeInventory' does not contain a definition forRemoveAllInCategory' and no extension method RemoveAllInCategory' of typeAC.RuntimeInventory' could be found. Are you missing an assembly reference?

I tried to reopen RuntimeInventory and there isnt a RemoveAllInCategory function now
I tried to add it myself but it threw up a bunch of other errors

Does anyone know how to fix it?

Thank you so much!! <3

«1

Comments

  • edited April 2021

    One other thing:

    I appear to be getting much worse performance than my other AC version of the project

    When I press play in the editor, it takes (and I timed) 17 seconds for the game to start playing, average of 320 FPS and 3.1ms

    However on my backup build it takes 5 seconds and around average of 530FPS and 1.8ms (v1.70.1)

    Both projects are exactly the same barring different versions of AC (and the changes needed to my player spawning scripts to accommodate that)

    https://imgur.com/a/rtUdy4o heres what the profiler says

    Thanks again and sorry for the trouble! :blush:

  • I tried to reopen RuntimeInventory and there isnt a RemoveAllInCategory function now

    AC's Inventory system was overhauled in v1.72.0. Items are now stored in collections, which have the functions previously present in RuntimeInventory:

    AC.KickStarter.runtimeInventory.PlayerInvCollection.DeleteAllInCategory (categoryID);
    

    I appear to be getting much worse performance than my other AC version of the project

    I can't see anything standing out in your screenshots, though it is cropped.

    The largest time value, however, comes from EditorOverhead - so it may only be an Editor issue. How do things compare in builds?

    See the Manual's "Performance and optimisation" chapter for an updated list of tips to boost performance.

  • Hi Chris,
    Thanks for getting back to me, fixed the inventory one! :)

    I went through the performance chapter of the manual again but it doesn't seem to have helped much. It's a bit of a bummer that it takes so long to play when you're just changing things quick and want to get into it fast.

    I'm not sure what the difference is with the previous version because it was very quick compared to now. Even with the editor overhead it still only takes 2 seconds beforehand.

    I did a deep profile, and I found something

    - Old Version

    - New Version

    On the previous version multiscenechecker was only 8ms and now its 100. It seems to be do with the save system. Could that be it?

  • Keep expanding it so that we can see the root cause.

  • edited April 2021

    Hey Chris,
    Does this help?

  • It looks to be coming from an ActionList that's assigned in a Menu's "ActionList when turn on" field.

    Try locking your initial menus until the issue stops, to isolate which Menu, and ActionList, is causing the issue.

    Then try ending that ActionList prematurely at different points (e.g. after 1st Action, then after 1st 5, 10 etc) to narrow down which Action is causing it.

  • Hi Chris,
    Thanks so much for the replies and I'm sorry this is an annoying inconvenience

    I've locked off my normal menus and disabled the on start actionlist but I'm not getting much luck. I did the same thing on my old version + a version with everything enabled on my old one to compare

    https://youtube.com/watch?v=2k3GGaegNdQ

    You'll see what I mean
    Its weird because the only thing thats changed is the AC update files :(

  • edited April 2021

    Don't worry, we'll sort the issue - but we first need to find the cause.

    Can you share a new equivalent of your last screenshot, showing the new full hierarchy?

    What else can you share about your startup process? Do you have an "ActionList on start game" assigned? How many menus and Player characters are normally enabled by default?

  • edited April 2021

    Hi Chris,
    Heres a recording of the new version with everything enabled like normal - https://www.youtube.com/watch?v=196SMtOG5pI

    • I didnt know theres an actionlist on start game option lol, I do have an on scene start like before but even disabled it doesn't help (as you saw)

    By default there are 2 menus enabled, both Unity UI

    I actually have 10 characters in the player switching field, but all of their start points are in an empty scene except the main character, so only 1 spawns in. They never need to be seen in a scene until the player decides to switch character (as in they are not NPCs in the world, they're either there or not).

    Out of curiosity I changed player switching to "do not allow" and it didn't have any effect on start timing...

    avatest.cs in the profiler is just a custom script that checks whether a bunch of npc character location variables is the current scene, and if so starts a cutscene that does all the npc spawning etc. - Again out of curiosity I commented the entire thing out and no difference...

    I recorded the hierarchy with the script disabled and tried to go through the main top ones https://www.youtube.com/watch?v=jI5x53_2G7E

  • edited April 2021

    We need to investigate Profiler items with a high "Time ms" value - not necessarily a high GC Alloc. The videos do suggest that Editor Overhead has the highest value here. Please see my earlier question: is this an issue only in the Editor, or in Builds as well?

    Please also share as much as you can about your project. How large is your Resources folder? Does this occur when starting in any AC scene? How about a fresh, non AC scene?

    Try also temporarily switching your Settings Manager's Volume control to Audio Sources - that's the main thing I see being refererenced in your Profiler.

  • Hi Chris - Do you mean "Audio settings, volume controlled by - Audio Sources" ? It's already set to that haha

    If I do file > new scene without adding anything, it takes 4 seconds to start

    My resources folder has my player prefabs, a folder of which I assume is my AC's game manager folder, and a script to turn off ac. In other words its 3MB big lol

    I built the game to android and there is a massive difference in loading time compared to the last build... like a whole extra minute. :s

  • Your Resources folder does not need to contain your Player prefabs - and neither your script. Remove them from Resources - even if that doesn't directly affect this issue, it'll still benefit.

    Your video only shows the first frame of the Profiler. Try scrolling forward to find the one with the largest "Time ms" value, and share screens of its breakdown.

    Which AC version exactly were you using before, and what Unity versions in both?

    Open up Options.cs, and find the line:

    StartCoroutine (UpdateMixerVolumes ());
    

    Replace it with:

    if (KickStarter.settingsManager.volumeControl == VolumeControl.AudioMixerGroups) StartCoroutine (UpdateMixerVolumes ());
    

    Let me know also the result of:

    1) Starting a fresh AC scene
    2) Starting your own scene but with the Demo game's Managers assigned (don't worry about error messages, we're just looking at startup times)

  • edited April 2021

    Hi Chris,
    The first frame is the one with the largest time ms value, but I tried to screenshot some of the other spikes near the beginning

    Here it is, with everything enabled (and the options.cs change) - https://imgur.com/a/b3B5Zkt

    Unity 2018.2.21f1 on both
    New version - AC v1.73.6
    Old version - AC v1.70.1

    Fresh AC scene with nothing else in it - https://imgur.com/a/xWnYpdJ

    The scene in the videos but using the Demo managers https://imgur.com/a/eQeaQS4

    The demo game's manager takes about the same time as the old project, though bearing in mind I have 357 global variables and 94 menus over the span of 4 years including ac's built in ones (but that doesnt really account for why it runs quickly on the old ac version)

    Does that help at all? Thanks again :)

  • It definitely looks like the menus are the problem. You're still keeping the initial ones locked off for the moment?

    Try looking into ones that have an Appear type of Mouse Over - how many of these do you have?

    With 94 menus in total, I'm more surprised that it didn't run slowly before. I have to suggest reducing these - combining them where possible. Can you share some details as to how so many are necessary?

  • edited April 2021

    Hi Chris,

    A lot of them were made when I was new to game development, there's an interact menu for every character (every single one) and I definitely could combine them into 1 menu and just change the graphic and label variable when entering their trigger. Just didn't really occur to me since I didn't have any trouble before.

    Here's the kicker, I just went through all the menus and NONE of them are using Appear type of Mouse Over. :D

    The majority of them (my ones) are manual.

    The menus weren't locked off I enabled them all for the "current" screenshots. Here's the spikes with the menus locked off. https://imgur.com/a/871bP3x

    Then again if I disable the on scene start cutscene I get this

    https://imgur.com/a/tXKwqfT

    I'm just really confused, lol

    Thanks again Chris :)

  • there's an interact menu for every character (every single one) and I definitely could combine them into 1 menu and just change the graphic and label variable when entering their trigger.

    I'd certainly recommend that.

    I just went through all the menus and NONE of them are using Appear type of Mouse Over.

    In that case, it should be safe to disable the process I'm seeing in the Profiler. Open up PlayerMenus.cs, and comment out both instances of:

    StartCoroutine (CycleMouseOverUIs ());
    

    Does that have any noticeable effect?

    Then again if I disable the on scene start cutscene I get this

    What is the start-up time like in this instance?

  • Doesnt seem to make a difference

    Now its telling me that its playing an on start cutscene despite having set it to nothing in the settings menu. Then I thought it was the "action list on enabled" on one of my menus so I took that off but its still saying this:

    https://imgur.com/a/cDuimUu

    Think I might just cut my losses and live with the old version at this point lol

  • It's definitely suggesting it's coming from a Menu's "ActionList when turn on".

    There's an easy way to tell what. Open up RuntimeActionList.cs, and paste the following at the top of its DownloadActions function:

    Debug.Log ("Preparing to run asset " + actionListAsset, actionListAsset);
    

    How many instances of this appear when the game initialises, and what are the full messages?

  • Ok, I've managed to turn off absolutely every actionlist that would load on start up, no logs are showing but theres still a 12 second delay with all actionlists off

    https://imgur.com/a/SuBTGqk

    Just to make sure I wasn't being dumb I went back to the old project and reloaded with everything on, only 2 second delay

    I guess it must just be a collection of all the new AC things that has been added over the years and it cant really be avoided?

  • edited April 2021

    If the "old project" you're referring to was using v1.70.1, it's not so old that it should make such a difference - but the number of Menus your project has is still going to contribute to the startup time.

    But your Profiler screenshot doesn't show any delay beyond the EditorOverhead that may be coming from the Deep Profile itself. How does this Profile compare with the older project?

    Having made these changes, I'd recommend comparing build times again to see if the delay is now limited to the Editor.

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.