4
1

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 3 years have passed since last update.

Unityからプリンターを動かす

Last updated at Posted at 2021-08-30

初めに

Unityからプリンターを動かしてみたいと思い、いろいろ調べてみた

先人

調べればすぐ出てくる!これは素敵!

プラグインのエラーがとれない

System.Drawing.PrintingのPrintingなんて、知らないnamespaceと言われる
なるほど、ApiCompatibilityLevelをかえねーとよめね~わな。。
ということで、
1,Assetsの下にPluginsフォルダを作成
2,ApiCompatibilityLevelを.Net4.xに変える

に修正でもエラーが出続ける。。

プラグインのdllの行方。。

先人の『System.drawing.dll』の行方がわからず、Windows内を全検索してみたら、
結構同一ファイル名のdllが出てくる、
Pluginsフォルダを作って、Windows内で出てきたSystem.drawing.dllを入れたら
エラーは回避できた!うごけ~~!

image.png

再生は出来るが、

Loading assembly failed: "Assets/Plugins/System.Drawing.dll" reason: File does not contain a valid CIL image

エラーーがどうしたものか。。

上記のkaigangamesさんの書き込み

C:\Program Files\Unity\Hub\Editor\2020.1.6f1\Editor\Data\MonoBleedingEdge\lib\mono\4.5
の下位のフォルダにあるdllを持ってきたら、エラー回避できたよ~
って書いてある、これだ!!

image.png

自分は、2020.3.16f1の環境で作ったていたから、上記のフォルダの『System.drawing.dll』を使ったら、
先ほどのエラーも出なくなった!

最後に

C#ように書いてある、プログラムはdll読み込めば、たいていの事は出来るのは楽ですね。

プログラムのデバックをするのに、プリンターがガンガン動いて紙の無駄。。

プリンターを使ったアプリゲーム作ってみようかな!

4
1
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
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?