Building a Framework

版本检查: 2017.3

-

难度: 中级

In this session Online Evangelist Matt Gambell will take us through building a system that allows for a flexible and customisable way to work with UI in a project by taking advantage of the power of ScriptableObjects.

Building a Framework

中级 User Interface (UI)

FlexibleUIData

Code snippet

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(menuName = "Flexible UI Data")]
public class FlexibleUIData : ScriptableObject
{
    
}

FlexibleUI

Code snippet

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FlexibleUI : MonoBehaviour {

    public FlexibleUIData skinData;

    protected virtual void OnSkinUI()
    {

    }

    public virtual void Awake()
    {
        OnSkinUI();
    }

    public virtual void Update()
    {
        if(Application.isEditor)
        {
            OnSkinUI();
        }
    }

}

相关教程