Hi Rookie question: In the follow script I want to delete a panelInfo variable from the Inspector, make it private but I got many errors when change to private.
I can not figure out how to set panelInfo.SetActive (true) for a private variable
Any tips are welcome…
Just updated with some tips from nice users, but still is not working
I get errors in panelInfo.SetActive(true); panelInfo.SetActive(false);
Thanks for your help
using UnityEngine;
using System.Collections;
public class HighlightBlue : MonoBehaviour {
public Color selectedColor;
public Texture2D partInfo;
[HideInInspector]
public GameObject panelInfo;
void Start(){
panelInfo = GameObject.FindWithTag("panelInfo");
panelInfo.SetActive(false);
}
public void myColorChange(Color col) {
GameObject[] fullG = GameObject.FindGameObjectsWithTag(“Blue”);
foreach(GameObject gmo in fullG) {
gmo.renderer.material.color = col;
}
}
void OnTouchDown () {
this.myColorChange(selectedColor);
panelInfo.SetActive(true);
panelInfo.renderer.material.mainTexture = partInfo;
}
void OnTouchUp () {
this.myColorChange(Color.white);
panelInfo.SetActive(false);
}
void OnTouchStay () {
this.myColorChange(selectedColor);
panelInfo.SetActive(true);
panelInfo.renderer.material.mainTexture = partInfo;
}
void OnTouchExit () {
this.myColorChange(Color.white);
panelInfo.SetActive(false);
}
}