- Home /
Animation is broken
Can anybody help me I'm trying to animate a player for my menu scene but the animation just plays to the first frame then it stops, I have clicked play automatically ect. The strange thing is, when I try the animation in my actual game scene it plays perfectly. If you need more info or a video go to the link below, I asked on another forum and they weren't able to help me
http://forum.armedunity.com/viewtopic.php?f=37&t=1226
Please help me, in till this is solved I can't continue making my game
Edit: so I have found what makes the animation play, the pause menu script. I eith want to make the script so it doesn't show GUI and locks the mouse or just take the part that makes it play.
Here is the code //@script ExecuteInEditMode() // script from http://forum.unity3d.com/threads/74127- ... -PauseMenu var skin:GUISkin; private var gldepth = -0.5; private var startTime = 0.1; var nativeVerticalResolution = 1200.0; var scaledResolutionWidth = nativeVerticalResolution / Screen.height Screen.width; var mat:Material; private var tris = 0; private var verts = 0; private var savedTimeScale:float; private var pauseFilter; private var showfps:boolean; private var showtris:boolean; private var showvtx:boolean; private var showfpsgraph:boolean; var lowFPSColor = Color.red; var highFPSColor = Color.green; var lowFPS = 30; var highFPS = 50; //var start : GameObject; var url = "WebPlayer.html"; var statColor:Color = Color.yellow; var GuiColor:Color = Color.white; var credits:String[]=[ "Credits:", "armedunity.com", "bbb", "aaa"] ; var crediticons:Texture[]; enum Page { None,Main,Options,Credits } var currentPage:Page; private var fpsarray:int[]; private var fps:float; function Start() { fpsarray = new int[scaledResolutionWidth]; Time.timeScale = 1.0; PauseGame(); } function OnPostRender() { if (showfpsgraph && mat != null) { GL.PushMatrix (); GL.LoadPixelMatrix(); for (var i = 0; i < mat.passCount; ++i) { mat.SetPass(i); GL.Begin( GL.LINES ); for (var x=0; x Screen.width; GUILayout.BeginArea(Rect(scaledResolutionWidth/2 - (width/2), nativeVerticalResolution/2 - (height/2),width,height)); } function EndPage() { GUILayout.EndArea(); if (currentPage != Page.Main) { ShowBackButton(); } } / function IsBeginning() { return Time.time < startTime; }/ function PauseMenu() { BeginPage(500,300); if (GUILayout.Button ("Return to game")) { UnPauseGame(); } if (GUILayout.Button ("Options")) { currentPage = Page.Options; } if (GUILayout.Button ("About")) { currentPage = Page.Credits; } if (IsBrowser() && GUILayout.Button ("Restart")) { Application.OpenURL(url); } EndPage(); } function GetObjectStats() { verts = 0; tris = 0; var ob = FindObjectsOfType(GameObject); for (var obj in ob) { GetObjectStats(obj); } } function GetObjectStats(object) { var filters : Component[]; filters = object.GetComponentsInChildren(MeshFilter); for( var f : MeshFilter in filters ){ tris += f.sharedMesh.triangles.Length/3; verts += f.sharedMesh.vertexCount; } } function PauseGame() { savedTimeScale = Time.timeScale; Time.timeScale = 0; AudioListener.pause = true; if (pauseFilter) pauseFilter.enabled = true; currentPage = Page.Main; transform.position = new Vector3(0, 1, 0); Screen.lockCursor = false; } function UnPauseGame() { Time.timeScale = savedTimeScale; AudioListener.pause = false; if (pauseFilter) pauseFilter.enabled = false; currentPage = Page.None; transform.position = Vector3.zero; Screen.lockCursor = true; } function IsGamePaused() { return Time.timeScale == 0; } function OnApplicationPause(pause:boolean) { if (IsGamePaused()) { AudioListener.pause = true; } }
You have to log in on that forum to view the topic - if you post the info & video link here in a comment (like this one) it'll be easier to say what's happening :-)
To much info to add, there's like 80 replies to this topic, the basic Idea is. There is something in my pausemenu script that makes the animation play. I either want to remove the GUI that it shows or take the part of the script that makes animations play. I can't post the script it's to long Ill try post above