- Home /
Error CS1061 I can't find a solution! [C#]
Hi, I'm new to unity and i got my script but it's not working and i can't find the reason can someone help me?
This is my script: C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameEnd : MonoBehaviour {
public GameObject CanvasIG;
public GameObject CanvasEnd;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter(Collider EndPad)
{
if (EndPad.gameObject.tag == "Player") {
CanvasIG.GameObject.SetActive (false);
CanvasEnd.GameObject.SetActive (true);
} else {
}
}
}
That code should make a canvas appear and anotherone disappear when the player is colliding with an object. Thank you in advanced.
Comment
Best Answer
Answer by jorrit5477 · Dec 16, 2016 at 10:47 AM
On line 22 and 23 you try to use the member GameObject
on GameObject references. This member doesn't exist on GameObject. At both lines change`.GameObject.SetActive` to .SetActive
.
Your answer
Follow this Question
Related Questions
When using URP, colliders stop working 2 Answers
Trigger help! 0 Answers
Multiplayer Layers and Colliders confusion. 1 Answer
(Solved) Collision happens, but is not detected? 1 Answer
Picked up objects passes through objects 2 Answers