public override bool OnSceneCreate()
    {
        switch (createState)
        {
        case CreateState.ResourceRequest:
            resourceRequestSet.Add("cube", ResourceType.AssetBundle);
            ResourceManager.Instance.RegisterRequestSet(
                RequestResourceLabel, resourceRequestSet);
            createState = CreateState.ResourceRequestWait;
            break;

        case CreateState.ResourceRequestWait:
            if (resourceRequestSet.IsComplete() == true)
            {
                Object prefab = ResourceManager.Instance.GetAssetBundle("cube");
                Debug.Log(prefab);
                instance = Object.Instantiate(prefab) as GameObject;
                instance.transform.SetParent(transform.parent);
                createState = CreateState.Complete;
            }
            break;

        case CreateState.Complete:
            createState = CreateState.ResourceRequest;
            return(true);

        default:
            break;
        }
        return(false);
    }
示例#2
0
    public override bool OnSceneCreate()
    {
        switch (createState)
        {
        case CreateState.ResourceRequest:
            resourceRequestSet.Add("ExampleTexture", ResourceType.Asset);
            ResourceManager.Instance.RegisterRequestSet(
                RequestResourceLabel, resourceRequestSet);
            createState = CreateState.ResourceRequestWait;
            break;

        case CreateState.ResourceRequestWait:
            if (resourceRequestSet.IsComplete() == true)
            {
                createState = CreateState.Complete;
            }
            break;

        case CreateState.Complete:
            createState = CreateState.ResourceRequest;
            return(true);

        default:
            break;
        }
        return(false);
    }