Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Why is my destroy platform script now working? NullReferenceException: Object reference not set to an instance of an object.

$
0
0
using UnityEngine; using System.Collections; public class PlatformDestroyer : MonoBehaviour { public GameObject platformDestructionPoint; // Use this for initialization void Start () { platformDestructionPoint = GameObject.Find ("PlatformDestructionPoint"); } // Update is called once per frame void Update () { if(transform.position.x < platformDestructionPoint.transform.position.x) { Destroy (gameObject); } } } ![alt text][1] [1]: /storage/temp/67821-screenshot-2016-04-11-172234.png Hello, I am a complete beginner to Unity and am trying to learn by following a 2d endless runner tutorial. So far it has been well, but when trying to create a script that destroys platforms after my character passes by I keep getting an error message. It has something to do with line 16 of my code and I have no idea what it means or how to fix it. Please help me to fix my problem. Thank you!

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>