🧩

Unity -- scriptでobjectを設定する Setting up objects with script inC#

2023/01/01に公開

大きな目標

Unityの空間で検索結果を三次元的に表示する。
 Display search results in three dimensions in Unity space.

中期的な目標

検索情報をC#でUnityに送り込む
Send search information to Unity with C#

今日の目標

Scriptからobjectを設定する。
Set up objects from Script.

Unity 2021.3.11f1 を使用

参考記事

https://biotech-lab.org/articles/4280

  • 新規Projectを作る。 Create a new Project.
  • 空のGameObjectを作りGameManagerと命名。 Create an empty GameObject and name it GameManager
  • ManagerというScriptを作りGameManagerにattach。Create a script called "Manager" and attach it to GameManager
  • 形、位置、回転、色の異なる四つのobjectを指定。 Specify four objects of different shapes, positions, rotations, and colors

sceneでの操作なしに、objectを作成できた。今後、指定内容を検索結果から導入できるようになれば、期待する表示がえられる、はず。

まとめ

2020年の記事で、versionも異なったが(記事はUnity 2019.4.1f1)問題なかった。
 2023年を幸先よくスタートできたと思う。

https://github.com/dongri727/1jan2023

Discussion