- Home /
c# Set Active error, conflicting with other code..
Hi all, i have ads on my app but im looking into eCPM instead. Im now looking into using revmob and its conflicting with the following code. using UnityEngine; using System.Collections;
public class Tutorial : MonoBehaviour
{
public GameObject Image1;
public GameObject Image2;
public GameObject Image3;
public GameObject Image4;
public GameObject Image5;
public GameObject Image6;
public int count = 0;
public AudioClip sound;
void Update ()
{
foreach (Touch touch in Input.touches)
{
if (touch.phase == TouchPhase.Ended)
if (count == 0){
count = count + 1;
} else if (count == 1){
Image1.SetActive(false);
Image2.SetActive(true);
audio.PlayOneShot(sound);
count = count + 1;
} else if (count == 2){
Image2.SetActive(false);
Image3.SetActive(true);
audio.PlayOneShot(sound);
count = count + 1;
} else if (count == 3){
Image3.SetActive(false);
Image4.SetActive(true);
audio.PlayOneShot(sound);
count = count + 1;
} else if (count == 4){
Image4.SetActive(false);
Image5.SetActive(true);
audio.PlayOneShot(sound);
count = count + 1;
} else if (count == 5){
Image5.SetActive(false);
Image6.SetActive(true);
audio.PlayOneShot(sound);
count = count + 1;
} else if (count == 6){
audio.PlayOneShot(sound);
Application.LoadLevel ("Menu");
}
}
}
}
coming up with this error
Error: Analytics Event: 5(Compiler*error CS1061*Type `GameObject' does not contain a definition for `SetActive' and no extension method `SetActive' of type `GameObject' could be found (are you missing a using directive or an assembly reference?))(1): skipped because it was sent more than once in 0.10 seconds
Assets/Scripts/Tutorial.cs(45,48): error CS1061: Type `GameObject' does not contain a definition for `SetActive' and no extension method `SetActive' of type `GameObject' could be found (are you missing a using directive or an assembly reference?)
The following code, if removed from the project there will be no errors, but causes the above error if it is in the game.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameObject : MonoBehaviour {
private static readonly Dictionary<String, String> REVMOB_APP_IDS = new Dictionary<String, String>() {
{ "Android", "5347c63064234ab25e0f4868"},
};
private RevMob revmob;
void Awake() {
revmob = RevMob.Start(REVMOB_APP_IDS, "Ads");
}
}
I appreciate the help!
Answer by corriedotdev · Apr 11, 2014 at 11:21 AM
OK again i have answered my own question. The script was in a different scene. And it turns out i already am using eCPM
Thanks
Your answer
![](https://koobas.hobune.stream/wayback/20220613142450im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I alter all children of a gameobject at once? 1 Answer
gameObject.setActive(false) is disabling the wrong objects 2 Answers
GameObject.setActive(bool) is not activating my gameObject 1 Answer
Multiple Cars not working 1 Answer
GameObjects that I deactivate are reactivated immediately 0 Answers