none
HELP!!, object reference is required for method RRS feed

  • Question

  • using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class Death_zone : MonoBehaviour {
        public GameObject[] objectToBeActivated;
       // public GameObject Obectactive;

    // Use this for initialization
    void Start ()
        {
            
        }

    // Update is called once per frame
    void Update ()
        {

    }

        private void OnTriggerEnter(Collider other)
        {
            
            if (other.gameObject.tag == ("Player"))
                
                {
                foreach (GameObject item in objectToBeActivated)
                    {
                    GameObject.SetActive(true);
                    }
                }
            
                

        }
    }
    • Moved by Bob Ding Thursday, November 23, 2017 6:15 AM not related wpf
    Tuesday, November 14, 2017 11:41 AM

All replies

  • Hi,

    Could you please use the "insert code block" for code.

    It's the button with angle brackets to the right of the html button.

    .

    What that error means is you've passed a null object into a method

    Maybe that means  here

    private void OnTriggerEnter(Collider other)

    or maybe here

     foreach (GameObject item in objectToBeActivated)

    I don't know, because you've not told us where the error occurs.

    Even if you did, there probably isn't enough code to tell exactly why and I "do" WPF and not Unity. It seems likely this is really a Unity question rather than WPF.


    Hope that helps.

    Technet articles: WPF: Layout Lab; All my Technet Articles

    Tuesday, November 14, 2017 12:45 PM