1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[Unity]Zenject(Extenject)を練習してみた

Last updated at Posted at 2021-04-02

最初に

この記事は先達の方々の記事をなぞった過程をまとめただけの記事です。僕と同じように「Zenjectをとりあえず触ってみたい」と思った方のちょっとした道しるべになればと思い記事にしました。
今回、Zenjectを理解する為に3つの記事を参考にして動作確認できるプロジェクトを作りました。

Extenjectについて

Zenjectは更新が止まってしまいUnityAssetStoreでの公開は終了しています。代わりに今回はExtenjectを使用しました。Package Managerからインポートできます。
スクリーンショット 2022-12-21 6.51.05.png

参考記事:「Extenjectとは」の項
https://qiita.com/4_mio_11/items/4306732bc47780802b74#extenjectとは

Dependency Injectionについて

Zenjectを使用するとDependency Injectionというデザインパターンを実現する事ができます。
Dependency Injectionのイメージはこの図がわかりやすいと思います
参考記事:「Dependency Injectionとは」の項
https://note.com/thedesignium/n/n771fb79ab263

実際に作ってみる

参考記事
https://light11.hatenadiary.com/entry/2019/02/16/225023
実際の動作確認はこの記事に従うと簡単に出来ると思います。
記事ではZenjectを使用していますが、上にも書いた通りUnityAssetStoreでの公開は終了しています。Extenjectをインポートしていてもコードの変更は一切必要なく動作しました。

補足

Zenjectは参考にできる資料がとても少なかったです。
とりあえず僕と同じように「難しぃ~」と感じてる方は上記3記事を渡り歩くと理解が深まると思います。

さらに理解を深めるために

Unity開発で使える設計の話+Zenjectの紹介
https://www.slideshare.net/torisoup/unityzenject

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?