- Home /
Question by
jack_sparrow · Oct 12, 2012 at 09:06 AM ·
javascripting
having prob while accessing java boolean from c# script
using UnityEngine;
using System.Collections;
[AddComponentMenu("Camera-Control/Keyboard Orbit")]
public class Guikeys : MonoBehaviour {
private info myscript;
void OnGUI(){
if(GUI.RepeatButton(new Rect(1115,470,56,29),"",uptexture))
{
GUIVertical1 = 1;
myscript = this.GetComponent<info>();
myscript.image2 = true; // error here
}
}
}
Error is
Static member `info.image2' cannot be accessed with an instance reference, qualify it with a type name instead
can u guys tell me where am i doing it wrong ??
thanx regards
Comment
Answer by hvilela · Oct 12, 2012 at 09:48 AM
The error is saying pretty much everything: Your variable "image2" is static, so you cannot use an instance to access it. Replace this:
myscript = this.GetComponent<info>();
myscript.image2 = true; // error here
for this:
info.image2 = true;
or remove the keyword "static" from your image2 variable in the "info" script.