質問編集履歴
5
フォルダ構成を追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -311,3 +311,93 @@
|
|
311
311
|
}
|
312
312
|
|
313
313
|
```
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
### フォルダ構成
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
```txt
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
C:.
|
326
|
+
|
327
|
+
│ Igaguri.csproj
|
328
|
+
|
329
|
+
│ Igaguri.sln
|
330
|
+
|
331
|
+
│ Igaguri_Android.apk
|
332
|
+
|
333
|
+
│
|
334
|
+
|
335
|
+
├─Assets
|
336
|
+
|
337
|
+
│ │ GameScene.unity
|
338
|
+
|
339
|
+
│ │ igaguri.fbx
|
340
|
+
|
341
|
+
│ │ IgaguriController.cs
|
342
|
+
|
343
|
+
│ │ IgaguriGenerator.cs
|
344
|
+
|
345
|
+
│ │ igaguriPrefab.prefab
|
346
|
+
|
347
|
+
│ │ New Terrain 1.asset
|
348
|
+
|
349
|
+
│ │ New Terrain.asset
|
350
|
+
|
351
|
+
│ │ target.fbx
|
352
|
+
|
353
|
+
│ │ test.prefab
|
354
|
+
|
355
|
+
│ │
|
356
|
+
|
357
|
+
│ └─Standard Assets
|
358
|
+
|
359
|
+
│
|
360
|
+
|
361
|
+
├─ProjectSettings
|
362
|
+
|
363
|
+
│ AudioManager.asset
|
364
|
+
|
365
|
+
│ ClusterInputManager.asset
|
366
|
+
|
367
|
+
│ DynamicsManager.asset
|
368
|
+
|
369
|
+
│ EditorBuildSettings.asset
|
370
|
+
|
371
|
+
│ EditorSettings.asset
|
372
|
+
|
373
|
+
│ GraphicsSettings.asset
|
374
|
+
|
375
|
+
│ InputManager.asset
|
376
|
+
|
377
|
+
│ NavMeshAreas.asset
|
378
|
+
|
379
|
+
│ NetworkManager.asset
|
380
|
+
|
381
|
+
│ Physics2DSettings.asset
|
382
|
+
|
383
|
+
│ ProjectSettings.asset
|
384
|
+
|
385
|
+
│ ProjectVersion.txt
|
386
|
+
|
387
|
+
│ QualitySettings.asset
|
388
|
+
|
389
|
+
│ TagManager.asset
|
390
|
+
|
391
|
+
│ TimeManager.asset
|
392
|
+
|
393
|
+
│ UnityConnectSettings.asset
|
394
|
+
|
395
|
+
│
|
396
|
+
|
397
|
+
└─UnityPackageManager
|
398
|
+
|
399
|
+
manifest.json
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
```
|
4
サンプルソースコードを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,6 +18,8 @@
|
|
18
18
|
|
19
19
|
7章の「3Dゲームの作り方」に挑戦しています。
|
20
20
|
|
21
|
+
[Sampleソースコード](http://www.sbcr.jp/support/14129.html)
|
22
|
+
|
21
23
|
Unity上の実行ツールで、正しく動くことは確認できました。
|
22
24
|
|
23
25
|
|
3
画像追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -22,6 +22,10 @@
|
|
22
22
|
|
23
23
|
|
24
24
|
|
25
|
+
![イメージ説明](23f56029bde6930abe0ac7c161869135.png)
|
26
|
+
|
27
|
+
|
28
|
+
|
25
29
|
# 問題
|
26
30
|
|
27
31
|
Unityの「Build & Run」でAndroidにインストールして、アプリを起動しました。
|
2
ソースコードの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -173,3 +173,135 @@
|
|
173
173
|
# 質問
|
174
174
|
|
175
175
|
上記の問題を解決する方法を教えていただきたいです。
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
# 補足:ソースコード
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
### IgaguriController.cs
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
```csharp
|
190
|
+
|
191
|
+
using System.Collections;
|
192
|
+
|
193
|
+
using System.Collections.Generic;
|
194
|
+
|
195
|
+
using UnityEngine;
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
public class IgaguriController : MonoBehaviour {
|
200
|
+
|
201
|
+
public void Shoot(Vector3 dir)
|
202
|
+
|
203
|
+
{
|
204
|
+
|
205
|
+
GetComponent<Rigidbody>().AddForce(dir);
|
206
|
+
|
207
|
+
}
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
void OnCollisionEnter(Collision collision)
|
212
|
+
|
213
|
+
{
|
214
|
+
|
215
|
+
GetComponent<Rigidbody>().isKinematic = true;
|
216
|
+
|
217
|
+
GetComponent<ParticleSystem>().Play();
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
// Use this for initialization
|
224
|
+
|
225
|
+
void Start () {
|
226
|
+
|
227
|
+
//Shoot(new Vector3(0, 200, 2000));
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
// Update is called once per frame
|
234
|
+
|
235
|
+
void Update () {
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
}
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
```
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
### IgaguriGenerator.cs
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
```csharp
|
252
|
+
|
253
|
+
using System.Collections;
|
254
|
+
|
255
|
+
using System.Collections.Generic;
|
256
|
+
|
257
|
+
using UnityEngine;
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
public class IgaguriGenerator : MonoBehaviour {
|
262
|
+
|
263
|
+
public GameObject igaguriPrefab;
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
// Use this for initialization
|
268
|
+
|
269
|
+
void Start () {
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
}
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
// Update is called once per frame
|
278
|
+
|
279
|
+
void Update () {
|
280
|
+
|
281
|
+
if (Input.GetMouseButtonDown(0))
|
282
|
+
|
283
|
+
{
|
284
|
+
|
285
|
+
GameObject igaguri = Instantiate(igaguriPrefab) as GameObject;
|
286
|
+
|
287
|
+
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
288
|
+
|
289
|
+
Vector3 worldDir = ray.direction;
|
290
|
+
|
291
|
+
//igaguri.GetComponent<IgaguriController>().Shoot(new Vector3(0, 200, 2000));
|
292
|
+
|
293
|
+
igaguri.GetComponent<IgaguriController>().Shoot(worldDir.normalized * 2000);
|
294
|
+
|
295
|
+
}
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
```
|
1
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Unity3DアプリをAndroidで起動すると、Unityロゴが表示された後、終了
|
1
|
+
Unity3DアプリをAndroidで起動すると、Unityロゴが表示された後、終了してしまう
|
test
CHANGED
File without changes
|