環境メモ
⭐️Mac OS Mojave バージョン10.14
⭐️Unity 2018.2.15f1
以下のエラーになる場合
DestroyScript.cs(28,28):
Warning CS0649: Field 'DestroyScript.life' is never assigned to, and will always have its default value 0 (CS0649) (Assembly-CSharp)
#pragma warning disable 0649
を追加すればOK
DestroyScript
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
* Prefabsの「bullet」と「HitParticles」
*/
public class DestroyScript : MonoBehaviour {
#pragma warning disable 0649
[SerializeField] float life;
void Start () {
// 球のゲームオブジェクトを破棄する
Destroy(gameObject, life);
}
}