Forum rules - please read before posting.

Got a bunch of errors on importing AC in a new project unity2022.3.5f1

New 2d URP project, latest version of AC 1.77.4 I've imported AC without the 2D and 3D demos got these two errors before it asks about the layers setup

Unable to import newly created asset : Assets/AdventureCreator/Editor/ACEditorPrefs.asset
UnityEngine.StackTraceUtility:ExtractStackTrace ()
AC.ACEditorPrefs:GetOrCreateSettings () (at Assets/AdventureCreator/Scripts/Managers/ACEditorPrefs.cs:106)
AC.ACEditorPrefs:get_DisableInstaller () (at Assets/AdventureCreator/Scripts/Managers/ACEditorPrefs.cs:434)
AC.ACInstaller:IsInstalled () (at Assets/AdventureCreator/Scripts/Managers/Editor/ACInstaller.cs:37)
AC.ACInstaller:CheckInstall () (at Assets/AdventureCreator/Scripts/Managers/Editor/ACInstaller.cs:52)
AC.ACInstaller:.cctor () (at Assets/AdventureCreator/Scripts/Managers/Editor/ACInstaller.cs:31)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])

and

UnityException: Creating asset at path Assets/AdventureCreator/Editor/ACEditorPrefs.asset failed.
AC.ACEditorPrefs.GetOrCreateSettings () (at Assets/AdventureCreator/Scripts/Managers/ACEditorPrefs.cs:106)
UnityEngine.Debug:LogException(Exception)
AC.ACEditorPrefs:GetOrCreateSettings() (at Assets/AdventureCreator/Scripts/Managers/ACEditorPrefs.cs:112)
AC.ACEditorPrefs:get_DisableInstaller() (at Assets/AdventureCreator/Scripts/Managers/ACEditorPrefs.cs:434)
AC.ACInstaller:IsInstalled() (at Assets/AdventureCreator/Scripts/Managers/Editor/ACInstaller.cs:37)
AC.ACInstaller:CheckInstall() (at Assets/AdventureCreator/Scripts/Managers/Editor/ACInstaller.cs:52)
AC.ACInstaller:.cctor() (at Assets/AdventureCreator/Scripts/Managers/Editor/ACInstaller.cs:31)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])

then after the layers creation logs these warnings

Problem detected while importing the Prefab file: 'Assets/AdventureCreator/Prefabs/Automatic/MainCamera.prefab'.
The file might be corrupt or have a missing Variant parent or nested Prefabs. See details below.
Warnings:
Component at index 2 could not be loaded when loading game object 'MainCamera'. Removing it.

and

Problem detected while loading the contents of the Prefab file: 'Assets/AdventureCreator/Prefabs/Automatic/MainCamera.prefab'.
Check the following logs for more details.

and

Component at index 2 could not be loaded when loading game object 'MainCamera'. Removing it.


Tried this a bunch of times and the errors always show up.

Opening AdventureCreator/Prefabs/Automatic/MainCamera.prefab triggers a pop up saying the prefab was changed and if I want to save the changes or i want to revert it back. I have revert it but I don't know if this will create problems down the road

Thanks for the help

Comments

  • edited July 2023

    Welcome to the community, @dgames. Apologies for the trouble so early on in your project.

    Are these warnings/errors having preventing AC from working? From what you've described, it looks like these are nuisances that can be safely ignored, rather than anything serious.

    got these two errors before it asks about the layers setup

    This is due to AC not being able to create its "ACEditorPrefs" file in the project - which isn't strictly necessary, as it'll still work without it.

    The install path should be in /Assets/AdventureCreator/Editor - does this file now exist? I'm unsure why this may occur - is your project on a local machine, or hosted somewhere else?

    then after the layers creation logs these warnings

    This is an annoying issue I've been trying to resolve, and it's to do with Unity deprecating certain components that automatically get attached to Cameras. I thought it'd been resolved earlier, so thanks for letting me know.

    You should be perfectly fine to save changes it wants to make automatically - as the component in question is deprecated, it's presence/absense should make no difference.

  • Are these warnings/errors having preventing AC from working?

    It works. :)

    does this file now exist?

    yes, ACEditorPrefs is present and appears to work. when clicking on it shows the options in the Inspector window

    as the component in question is deprecated

    which component is the one deprecated?

  • edited July 2023

    which component is the one deprecated?

    I don't recall exactly - could be GUI Layer, though oddly enough the AC package shouldn't include it. All that the MainCamera prefab requires, however, are the Camera, MainCamera, and AudioListener components.

  • edited January 12

    This happens because it is not allowed to read the Asset Database in InitializeOnLoad handlers: https://docs.unity3d.com/2023.2/Documentation/ScriptReference/InitializeOnLoadAttribute.html

    ACInstaller.cs attempts to verify the installation status by reading ACEditorPrefs.asset in its constructor which is called during InitializeOnLoad. I'd like to request this being fixed, @ChrisIceBox

    As per the suggestion on Unity's documentation, removing the CheckInstall call from ACInstaller's constructor and instead making ACInstaller inherit from AssetPostProcessor and adding this call does the trick for me in Unity 2022.3.x:

    private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        CheckInstall();
    }
    

    Now, I have not verified that this OnPostProcessAllAssets signature is the same across all versions of Unity, so a more thorough fix may be required.

  • Welcome to the community, @ahofstaedter_mipumi, and thanks for the feedback. I will look into this.

  • Yes, quite right. A similar change is also needed to ActionListAutosaving - I'll see to this as well.

  • edited January 15

    Thank you! :smile:
    Yes, I can confirm, ActionListAutoSaving is raising similar issues for me and they could be resolved in much the same way :+1:

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.