i have a gameObject called snow, that basicly is a particleSystem, what i want to do is, when my player pass trough a wall active the snow, it starts disabled.
To do that i started the gameobject disabled as i said, and when the ball colides with the wall i want to activate the snow. Like this:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class cameraChange : MonoBehaviour {
private Camera focusCamera;
private Camera mainCamera;
private MeshFilter WallTurn;
public GameObject snow;
// Use this for initialization
void Start () {
focusCamera = GameObject.Find("ModeCamera").GetComponent<Camera> ();
mainCamera = GameObject.Find("Main Camera").GetComponent<Camera> ();
WallTurn = GameObject.Find ("WallTurn").GetComponent<MeshFilter> ();
}
// Update is called once per frame
void OnTriggerEnter (Collider other) {
Debug.Log (snow);
if (other.gameObject.tag == "Player") {
focusCamera.enabled = false;
mainCamera.enabled = true;
WallTurn.transform.Rotate (0f, 0f, 180f);
snow.SetActive (true);
}
the problem is that i get this error Object reference not set to an instance of an object, i assigned the snow object on the inspector, and in the Debug.log it detects that it is a gameobject, what am i doing wrong?