- Home /
Please help? BCE0019: 'Matrix4x4' is not a member of 'UnityEngine.GUI'. ?
OK so Working on tutorial in Unity 3D and I know the tutorial is in Unity 2 however it was good up to this point were the tutorial want me to created this code:
@script ExecuteInEditMode()
var background : GUIStyle;
var gameOverText : GUIStyle;
var gameOverShadow : GUIStyle;
var gameOverScale = 1.5;
var gameOverShadowScale = 1.5;
function OnGUI(){
GUI.Label(Rect((Screen.width - (Screen.height * 2)) * 0.75, 0, Screen.height * 2, Screen.height), "", background);
GUI.Matrix4x4.TRS(Vector3(0, 0, 0), Quaternion.identity, Vector3.one * gameOverShadowScale);
GUI.Label(Rect((Screen.width / (2 * gameOverShadowScale)) - 150, (Screen.height / (2 * gameOverShadowScale)) - 40, 300, 100), "Game Over", gameOverShadowScale);
GUI.matrix = Matrix4x4.TRS(Vector3(0, 0 , 0), Quaternion.identity, Vector3.one * gameOverScale);
GUI.Label (Rect((Screen.width/(2 * gameOverScale)) - 150, (Screen.height / (2 * gameOverScale)) -40, 300, 100), "Game Over", gameOverText);
}
so I click play to see and I got this errors: Assets/GUI/GameOverGUI.js(10,13): BCE0019: 'Matrix4x4' is not a member of 'UnityEngine.GUI'. and Assets/GUI/GameOverGUI.js(11,18): BCE0023: No appropriate version of 'UnityEngine.GUI.Label' for the argument list '(UnityEngine.Rect, String, float)' was found.
can any one help???
The error on line 10 is simply that you are trying to use GUI.$$anonymous$$atrix4x4 and that does not exist. Perhaps you mean GUI.matrix (as you have on line 12).
The error on line 11 is simply that the last argument you pass is gameOverShadowScale which you defined to be a float. Perhaps you meant to pass the GUIStyle gameOverShadow, similar to your line 9.
Answer by waxyeye · Jun 26, 2011 at 10:44 PM
so now this code is now bug free code thanks to Graham Dunnett
@script ExecuteInEditMode()
var background : GUIStyle;
var gameOverText : GUIStyle;
var gameOverShadow : GUIStyle;
var gameOverScale = 1.5;
var gameOverShadowScale = 1.5;
function OnGUI(){
GUI.Label(Rect((Screen.width - (Screen.height * 2)) * 0.75, 0, Screen.height * 2, Screen.height), "", background);
GUI.matrix = Matrix4x4.TRS(Vector3(0, 0, 0), Quaternion.identity, Vector3.one * gameOverShadowScale);
GUI.Label(Rect((Screen.width / (2 * gameOverShadowScale)) - 150, (Screen.height / (2 * gameOverShadowScale)) - 40, 300, 100), "Game Over", gameOverShadow);
GUI.matrix = Matrix4x4.TRS(Vector3(0, 0 , 0), Quaternion.identity, Vector3.one * gameOverScale);
GUI.Label (Rect((Screen.width/(2 * gameOverScale)) - 150, (Screen.height / (2 * gameOverScale)) -40, 300, 100), "Game Over", gameOverText);
}
Your answer
Follow this Question
Related Questions
Matrix rotation of a Vector3 around three planes of rotation 1 Answer
Difference between pos.z and pos.w? 0 Answers
How to resize a single tile from a tilemap? 0 Answers
SelectionGrid parameters 1 Answer
Need help really quick! 1 Answer