forked from loongly/PureScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestLoader.cs
More file actions
50 lines (42 loc) · 1.18 KB
/
Copy pathTestLoader.cs
File metadata and controls
50 lines (42 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using System.Collections;
class TestLoader : MonoBehaviour
{
private void Start()
{
Debug.LogError("== TestLoader Start");
StartCoroutine(ResourcesLoad());
}
IEnumerator ResourcesLoad()
{
var resReq = Resources.LoadAsync<GameObject>("test/Capsule");
yield return resReq;
Debug.LogError("### Resources test/Capsule done. ");
var obj = Instantiate(resReq.asset) as GameObject;
if(obj != null)
{
obj.transform.position = Vector3.one;
}
var textReq = Resources.LoadAsync<TextAsset>("test/test_str");
textReq.completed += (opt) =>
{
Debug.LogError("### Resources test/test_str done. ");
var textAsset = textReq.asset as TextAsset;
Debug.LogError("text:" + textAsset.text);
};
}
private void OnDestroy()
{
Debug.LogError("== TestLoader OnDestroy ");
}
}