ScriptableObjectCollection icon indicating copy to clipboard operation
ScriptableObjectCollection copied to clipboard

Fix AssetDatabase.AssetPathExists compatibility for Unity versions before 2023.1

Open octo127 opened this issue 7 months ago • 0 comments

Summary

This PR fixes a compilation error that occurs when using Unity versions prior to 2023.1 due to the use of AssetDatabase.AssetPathExists, which was added in Unity 2023.1.0a4.

Changes

  • Added preprocessor directives to check Unity version
  • For Unity 2023.1 and newer: Use AssetDatabase.AssetPathExists
  • For older versions: Use AssetDatabase.LoadAssetAtPath<UnityEngine.Object>() != null as a fallback

Testing

  • Verified that the functionality works correctly on both Unity 2022.3 and 2023.1+

octo127 avatar Jun 19 '25 17:06 octo127