I tried everything but it just does not work, im at a loss.
`Script 1, attached to object Cube1
using UnityEngine;
using System.Collections;
public class clicked : MonoBehaviour {
public bool isclicked = false;
public int clickedby = 0;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}`
Script 2, attached to object Cube1
void OnMouseDown()
{
os = GetComponent<clicked>();
os.isclicked = True;
}
Why does this not work ? Its exactly as in the script reference on unity site, however, i get messages about os does not exist in current context.
I hope someone can help. My next problem is that the scripts are both on 9 cubes in my scene, and i would like to read out the isclicked value from another object too ;) but if i can solve my first problem, i think i can do my other one too.