Question by
DiamondMC102 · Sep 10, 2017 at 03:59 PM ·
scripting problemcollision2d game2d-platformercollision detection
Object reference not set to an instance of an object
NullReferenceException: Object reference not set to an instance of an object Indingo_Lava_Burst_Glitch_Fixed.Start () (at Assets/Scripts/Indingo_Lava_Burst_Glitch_Fixed.cs:18)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Indingo_Lava_Burst_Glitch_Fixed : MonoBehaviour {
private Indingo_Lava_Burst_Collider_Detecter_Attach_On_Enemies disableLavaBurst01;
private Indingo_Lava_Burst_Activator_Deactivator_Attach_On_Indingo disableLavaBurst02;
// Use this for initialization
void Start () {
disableLavaBurst01 = GetComponent<Indingo_Lava_Burst_Collider_Detecter_Attach_On_Enemies>();
disableLavaBurst02 = GetComponent<Indingo_Lava_Burst_Activator_Deactivator_Attach_On_Indingo>();
disableLavaBurst01.enabled = false;
disableLavaBurst02.enabled = false;
}
// Update is called once per frame
void FixedUpdate () {
}
void OnCollisionEnter2D(Collision2D coll) {
if (coll.gameObject.tag == "Enemy")
{
disableLavaBurst01.enabled = true;
disableLavaBurst02.enabled = true;
Debug.Log ("Indingo Collided With Enemy");
}
else
{
disableLavaBurst01.enabled = false;
disableLavaBurst02.enabled = false;
Debug.Log ("Indingo Did Not Collided With Enemy");
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Error: An object reference is required to access non-static member, help? 2 Answers
Player passenger moving when being pushed by two platforms 0 Answers
How to check for colliders when teleporting the player in a 2D game? 0 Answers
How i can fix a player controller bug? 0 Answers
What is ContactPoint.point? 0 Answers