Hi! I Sorry, but i have an embarrassing question … how do I create global variables in unity? :???:
Ok… but look if it’s right:
using UnityEngine;
using System.Collections;
public class LegendasVozes : MonoBehaviour
{
public int teste = 2;
}
And the other file script:
using UnityEngine;
using System.Collections;
public class OtherScript
{
int a = LegendasVozes.teste;
void Start (){}
void Update (){}
}
And this error appear:
Assets/NewBehaviourScript.cs(6,31): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `LegendasVozes.teste'
Nah, you want:
public static int teste = 2;
Oh! Thanks!