全局资源
- 将资源引用存为预设
- 使用单例模式,在创建实例时加载预设
- 使用资源时,只需要调用该单例
/*
------------------- Code Monkey -------------------
Thank you for downloading the Code Monkey Utilities
I hope you find them useful in your projects
If you have any questions use the contact form
Cheers!
unitycodemonkey.com
--------------------------------------------------
*/
using UnityEngine;
namespace CodeMonkey
{
/*
* Global Asset references
* Edit Asset references in the prefab CodeMonkey/Resources/CodeMonkeyAssets
* */
public class Assets : MonoBehaviour
{
// Internal instance reference
private static Assets _i;
// Instance reference
public static Assets i
{
get
{
if (_i == null) _i = Instantiate(Resources.Load<Assets>(