teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

エラー内容を追記しました。

2020/12/23 02:29

投稿

911RSR
911RSR

スコア13

title CHANGED
File without changes
body CHANGED
@@ -47,4 +47,55 @@
47
47
 
48
48
  ![Outline Effect](a4bc2daa97e4d0440dfd06ecd891383e.jpeg)
49
49
 
50
- ご教示よろしくお願い申し上げます。
50
+ ご教示よろしくお願い申し上げます。
51
+
52
+ 12/23追記
53
+ ご指導ありがとうございます!
54
+ scriptをご教示通りに、下記に変更しました。
55
+
56
+ ```C#
57
+ using System.Collections;
58
+ using System.Collections.Generic;
59
+ using UnityEngine;
60
+ using UnityEngine.UI;
61
+
62
+ public class HintButton : MonoBehaviour
63
+ {
64
+ public GameObject targetObject;
65
+
66
+ private OutlineEffect outlineEffect;
67
+
68
+ // Start is called before the first frame update
69
+ void Start()
70
+ {
71
+ outlineEffect = targetObject.GetComponent<OutlineEffect>();
72
+ }
73
+
74
+ // Update is called once per frame
75
+ void Update()
76
+ {
77
+
78
+ }
79
+
80
+ public void OnClick()
81
+ {
82
+ outlineEffect.enabled = !outlineEffect.enabled;
83
+ }
84
+ }
85
+
86
+ ```
87
+
88
+ しかしまたerrorCS0246が出てしまいました。。
89
+ ![エラーメッセージ](15a3327bae30fae11d629acebbe9ea97.jpeg)
90
+
91
+ ![VisualStudio](80660f500a01beb9a40904f292c3bfe1.jpeg)
92
+
93
+ どうやらOutlineEffectというnamespaceがうまく認識されていない??
94
+ ようなのですが、何か問題がありますでしょうか。。
95
+
96
+ ちなみにOutline effectは
97
+ https://baba-s.hatenablog.com/entry/2019/05/10/082000
98
+
99
+ こちらのrickomaxさんのgithubからスクリプト、シェーダーをダウンロードし、unityのプロジェクトウィンドウにドラッグ&ドロップして取得しました。
100
+
101
+ HintButtonの押下で輪郭表示のオンオフを切り替えたいという魂胆です。

1

outlieEffectのスペルミスを直しました(それでもうまく起動しません。。)

2020/12/23 02:29

投稿

911RSR
911RSR

スコア13

title CHANGED
File without changes
body CHANGED
@@ -30,14 +30,14 @@
30
30
 
31
31
  void OnClick()
32
32
  {
33
- if (outlieEffect.enabled = false)
33
+ if (outlineEffect.enabled = false)
34
34
  {
35
- outlieEffect.enabled = true;
35
+ outlineEffect.enabled = true;
36
36
  }
37
37
 
38
- if (outlieEffect.enabled = true)
38
+ if (outlineEffect.enabled = true)
39
39
  {
40
- outlieEffect.enabled = false;
40
+ outlineEffect.enabled = false;
41
41
  }
42
42
  }
43
43
  }