Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defaultIcon.png asset is included in the builds. #676

Open
juholyde-metacore opened this issue Nov 13, 2024 · 2 comments
Open

defaultIcon.png asset is included in the builds. #676

juholyde-metacore opened this issue Nov 13, 2024 · 2 comments

Comments

@juholyde-metacore
Copy link

Description

Asset defaultIcon.png uses the Resources API to load the asset, in the NugetWindow file causing the file to be included in the built game client.

// load the default icon from the Resources folder
defaultIcon = (Texture2D)Resources.Load("defaultIcon", typeof(Texture2D));

Resources API https://docs.unity3d.com/ScriptReference/Resources.html

When you place assets in "Resources" folders this can not be done, thus all assets in the "Resources" folders will be included in a build.

Alternatively, the AssetDatabase API should be more applicable for editor-only resources to be utilised.
https://docs.unity3d.com/ScriptReference/AssetDatabase.LoadAssetAtPath.html

  • NuGet Package: N/A
  • NuGetForUnity Version: 4.1.1
  • Unity Version: 2022.3.42f1 (unrelated)
  • Operating System: MacOSX (unrelated)
@juholyde-metacore
Copy link
Author

Initial search was not good enough but this seemed to be tacked here #650

@JoC0de
Copy link
Collaborator

JoC0de commented Dec 8, 2024

Do I understand this correctly that it is because defaultIcon.png is placed in Resources/defaultIcon.png when NuGetForUnity is installed using .unitypackage install method and not with the UPM / GIT install method where it is placed in Editor/Resources/defaultIcon.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants