質問編集履歴

1

ボタンのインスペクターの情報(OnClick)のスクショと、エラー全文を追記しました。

2020/11/20 05:11

投稿

MikanChan
MikanChan

スコア13

test CHANGED
File without changes
test CHANGED
@@ -14,15 +14,59 @@
14
14
 
15
15
  ### 発生している問題・エラーメッセージ
16
16
 
17
+ エラーが何行目か記載してほしいとのご依頼があったのですが、エラー文をみても記載がありません。
17
18
 
19
+ おそらく、public void OnClickGetSprite(Button button)の部分かな?と思っています。エラーの全文をコピペで貼っておきます。
18
20
 
19
21
  ```
20
22
 
21
23
  Object of type 'UnityEngine.Object' cannot be converted to type 'UnityEngine.UI.Button
22
24
 
25
+
26
+
27
+ <全文>
28
+
29
+ ArgumentException: Object of type 'UnityEngine.Object' cannot be converted to type 'UnityEngine.UI.Button'.
30
+
31
+ System.RuntimeType.CheckValue (System.Object value, System.Reflection.Binder binder, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <fb001e01371b4adca20013e0ac763896>:0)
32
+
33
+ System.Reflection.MonoMethod.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <fb001e01371b4adca20013e0ac763896>:0)
34
+
35
+ System.Reflection.MonoCMethod.DoInvoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
36
+
37
+ System.Reflection.MonoCMethod.Invoke (System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <fb001e01371b4adca20013e0ac763896>:0)
38
+
39
+ System.Reflection.ConstructorInfo.Invoke (System.Object[] parameters) (at <fb001e01371b4adca20013e0ac763896>:0)
40
+
41
+ UnityEngine.Events.PersistentCall.GetObjectCall (UnityEngine.Object target, System.Reflection.MethodInfo method, UnityEngine.Events.ArgumentCache arguments) (at <4cc8ec075538416496e5db5d391208ac>:0)
42
+
43
+ UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at <4cc8ec075538416496e5db5d391208ac>:0)
44
+
45
+ UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at <4cc8ec075538416496e5db5d391208ac>:0)
46
+
47
+ UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at <4cc8ec075538416496e5db5d391208ac>:0)
48
+
49
+ UnityEngine.Events.UnityEventBase.PrepareInvoke () (at <4cc8ec075538416496e5db5d391208ac>:0)
50
+
51
+ UnityEngine.Events.UnityEvent.Invoke () (at <4cc8ec075538416496e5db5d391208ac>:0)
52
+
53
+ UnityEngine.UI.Button.Press () (at C:/Program Files/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:68)
54
+
55
+ UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/Program Files/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Button.cs:110)
56
+
57
+ UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/Program Files/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:50)
58
+
59
+ UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) (at C:/Program Files/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/ExecuteEvents.cs:261)
60
+
61
+ UnityEngine.EventSystems.EventSystem:Update() (at C:/Program Files/2020.1.0f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:376)
62
+
63
+
64
+
23
65
  ```
24
66
 
67
+ Buttonのインスペクターの情報
25
68
 
69
+ ![イメージ説明](490437cb276c115197d79712489a732f.png)
26
70
 
27
71
  ### 該当のソースコード
28
72