跳到主要內容

發表文章

目前顯示的是 12月, 2023的文章

使用Unity Tilemap

 在製作地圖時為了資源的共用跟製作速度可以參考使用unity tilemap 首先在 Hierarchy 右鍵 / 2D Object / Tilemap / Rectangular 生成 tilemap 物件 再來選擇Grid 將 Cell Size 修改成 32 x 32(如果遊戲中用到的 chunk 是 32 x32 ) 接著開啟 tilemap 資源管理器, Window / 2D / Tile Palette 把資源管理清單的 sprite 貼圖拖曳到 Tile Palette 中間區塊, 資源更新如下 最上面的 tool 依序代表的是 "選擇"、"移動"、"畫筆"、"方形區域填充"、"取色"、"橡皮擦"、"填充" 首先在 tile palette 中選擇要使用的 tile,然後選擇"畫筆"工具,就可以直接在場景中繪製 tilemap 地塊 另外,將 sprite 拖曳到 tile palette 中時發現圖素很小,繪製的 tilemap 也是顯示很小 這時候必須調整原圖的 Pixels Per Unit 為 1 ,因為原圖大小 32 x 32 需要顯示在 32 各 Unity unit 上

ET 新增 Mysql 組件

 先確定已經安裝 Chloe 組件後將 MySqlContext 加入組件 接著在 System 中完成讀取配置跟連接 mysql 配置如下 獲取數據 List<Tbl_UserStageInfo> userStageInfos = mySqlComponent.dbContext.Query<Tbl_UserStageInfo>().Where(item => item.UserId == UserId).ToList(); 更新數據 mySqlComponent.dbContext.Update<Tbl_UserStageInfo>(userStageInfo);