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

質問編集履歴

1

ClickScript を書き換えました。

2019/11/10 15:00

投稿

Nanmotsu
Nanmotsu

スコア22

title CHANGED
File without changes
body CHANGED
@@ -11,20 +11,26 @@
11
11
  よろしくお願いします。
12
12
 
13
13
 
14
+ ClickScript を書き換え、上記のエラーは消えましたが
15
+ 実行したときに、Nullrefarence と出ます(Startの部分がうまくいってないよう)
16
+
17
+
14
18
  ```C# 
15
19
  using System.Collections;
16
20
  using System.Collections.Generic;
17
21
  using UnityEngine;
18
- using UnityEngine.UI;
22
+
19
- using UnityEngine.SceneManagement;
20
23
  public class clickScript : MonoBehaviour
21
24
  {
25
+ int a;
26
+ int b;
27
+ devideScript script;
22
28
 
23
29
  // Start is called before the first frame update
24
30
  void Start()
25
31
  {
26
- int a = GetComponent<devideScript>().devidednum;
32
+ a = script.devidednum;
27
- int b = GetComponent<devideScript>().devidenum;
33
+ b = script.devidenum;
28
34
 
29
35
  }
30
36
  // Update is called once per frame
@@ -60,6 +66,7 @@
60
66
  }
61
67
  }
62
68
 
69
+
63
70
  ```
64
71
 
65
72
  値を宣言したスクリプトはこちらです。