Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Last active March 1, 2019 11:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/70a09779c45cc1c9d9324bf9292f405b to your computer and use it in GitHub Desktop.
Save tsubaki/70a09779c45cc1c9d9324bf9292f405b to your computer and use it in GitHub Desktop.
ResourceManagerの超小さい例
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.ResourceManagement;
class Sample : MonoBehaviour
{
void Start()
{
// 初期化
// アセットをロードする方法(Provider)を登録
ResourceManager.ResourceProviders.Add( new LegacyResourcesProvider());
ResourceManager.InstanceProvider = new InstanceProvider();
// 生成する対象(Location)を生成
var location = new LegacyResourcesLocation("Obj");
var instanceParam = new InstantiationParameters(Vector3.zero, Quaternion.identity, null);
// ResourceManagerに対象(Location)を渡して、ロードしてもらう。方法はResourceManagerは知っている
ResourceManager.ProvideInstance<GameObject>(location, instanceParam);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment