(sorry for my english)
I have one public method in a script “Cam” attach to my GameObject “Main Camera”.
public Vector4 cadreWorld()
{
Camera cam = GetComponent<Camera>();
Vector2 temp = new Vector2(cam.aspect * cam.orthographicSize, cam.orthographicSize);
Vector2 origine = (Vector2)gameObject.GetComponent<Transform>().position - temp;
Vector2 taille = temp * 2;
return new Vector4(origine.x, origine.y, taille.x, taille.y);
}
and i access it in an other script
Vector4 temp = GameObject.Find("Main Camera").GetComponent<Cam>().cadreWorld();
it compile, no error, but when i play, unity freeze and i have to kill it.
it’s just that line, when i comment it, it work, and i use this method in the script where she is, and it work.
i don’t understand, thank you for your help.