Strange behavior When using the GUI buttons. (My fault not unity of course :) )
I have here, a Gui Script, That when "Buildings" is clicked, it drops down a list of "Buildings" that can be purchased.
Each one is linked to a 2D Texture. Now, the problem i am having is.
Clicking the button for Buildings - My game slows down to about 19 - 20 FPS. with nothing really rendering, but a capsule, a couple of boxes, and a small flat terrain.
Here is the Script:
var showMoreGui = false;
var icon1 : Texture2D;
var icon2 : Texture2D;
var icon3 : Texture2D;
var icon4 : Texture2D;
var icon5 : Texture2D;
function OnGUI () {
if (GUI.Button (Rect (10,10,100,20), "Buildings"))
showMoreGui = true;
if (showMoreGui)
ExtraGUI ();
}
function ExtraGUI () {
GUI.Button (Rect (10, 40,100,20), icon1, "Shack");
GUI.Button (Rect (10, 60,100,20), icon2, "Cottage");
GUI.Button (Rect (10, 80,100,20), icon3, "Cobblestone House");
GUI.Button (Rect (10, 100,100,20), icon4, "Townhouse");
GUI.Button (Rect (10, 120,100,20), icon5, "Windmill");
if (GUI.Button (Rect (10, 140,100,20), "Close"))
showMoreGui = false;
}
Now, during Runtime - I get the following Message:
Unable to find style 'Windmill' in skin 'GameSkin' repaint UnityEngine.Debug:LogWarning(Object) UnityEngine.GUISkin:GetStyle(String) UnityEngine.GUIStyle:op_Implicit(String) NewBehaviourScript:ExtraGUI() (at Assets\Scripts\NewBehaviourScript.js:27) NewBehaviourScript:OnGUI() (at Assets\Scripts\NewBehaviourScript.js:15) UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean) UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean) UnityEditor.GameView:OnGUI() System.Reflection.MonoMethod:InternalInvoke(Object, Object[]) System.Reflection.MonoMethod:InternalInvoke(Object, Object[]) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) System.Reflection.MethodBase:Invoke(Object, Object[]) UnityEditor.HostView:Invoke(String) UnityEditor.DockArea:OnGUI()
On a side note, i was looking through the Script Refernce Manual: Found the Style part, try to implement it, and I get syntax errors.. ACCKKK!!!!
Any help would be appreciated as always :)