Last active
March 1, 2019 11:29
-
-
Save tsubaki/70a09779c45cc1c9d9324bf9292f405b to your computer and use it in GitHub Desktop.
ResourceManagerの超小さい例
This file contains hidden or 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
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