-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: The new ResourcesAssetResolver is now used by default. AssetDatabaseAssetResolver has been moved to the new UIComponents.Editor assembly.
- Loading branch information
Showing
12 changed files
with
95 additions
and
53 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
namespace UIComponents.Core | ||
{ | ||
public interface IAssetLoader | ||
public interface IAssetResolver | ||
{ | ||
public T LoadAsset<T>(string assetPath) where T : UnityEngine.Object; | ||
|
||
public bool AssetExists(string assetPath); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using UnityEngine; | ||
|
||
namespace UIComponents.Core | ||
{ | ||
public class ResourcesAssetResolver : IAssetResolver | ||
{ | ||
public T LoadAsset<T>(string assetPath) where T : UnityEngine.Object | ||
{ | ||
return Resources.Load<T>(assetPath); | ||
} | ||
|
||
public bool AssetExists(string assetPath) | ||
{ | ||
return Resources.Load(assetPath) != null; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using UIComponents.Core; | ||
using UnityEditor; | ||
|
||
namespace UIComponents.Editor | ||
{ | ||
public class AssetDatabaseAssetResolver : IAssetResolver | ||
{ | ||
public T LoadAsset<T>(string assetPath) where T : UnityEngine.Object | ||
{ | ||
return AssetDatabase.LoadAssetAtPath<T>(assetPath); | ||
} | ||
|
||
public bool AssetExists(string assetPath) | ||
{ | ||
return !string.IsNullOrEmpty(AssetDatabase.AssetPathToGUID(assetPath)); | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "UIComponents.Editor", | ||
"rootNamespace": "UIComponents", | ||
"references": [ | ||
"GUID:d593635333b4cae48bac5b5f0b596e90" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.