一.案例演示
案例说明:模拟手游背包系统,背包界面可以滑动,每个格子展示道具id和数量
二.案例结构介绍
1.背包背景对象
挂载Image和脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class BackPack : MonoBehaviour
{
private GameObject item_prefab;
private RectTransform m_RectTransform;
private int itemNum = 17;
void Start()
{
//获取预制体
item_prefab = Resources.Load<GameObject>("item");
//获取预制体父节点
m_RectTransform = GameObject.Find("content").GetCo