- Home /
Animations cant be seen?
I have an animation problem. I have a Character, a GUI Button and animations assigned to him. The idea is he walks in, then a timer starts where he stands around, if the button is not pressed by the time the timer runs out, then he exits. If the button is pushed then a different animation plays and everything resets to when he just came in.
There are no errors on the console, however I cannot see the model when I play the scene, however when I come out of the main camera I can see the animations playing?
Here is the Unityscript I am using.
// JavaScript var myTimer : float = 10; public var introAnimation : AnimationClip; public var waitingAnimation : AnimationClip; public var exitAnimation : AnimationClip; public var answerAnimation : AnimationClip;
function OnGUI () { //Text box GUI.Label ( new Rect (370, 500, 400, 30), "Ask A Question From The List Below");
//Question 2 with box and response animation
if (GUI.Button (Rect (500, 550, 150,30), "Why Are You Here?")) {
//This code is executed when the Button is clicked
animation.PlayQueued("Answer", QueueMode.CompleteOthers);
}
//Starting animations
animation.PlayQueued("Intro", QueueMode.PlayNow);
//Waiting animations
animation.PlayQueued("Idle", QueueMode.CompleteOthers);
//timer for waiting animations
if (myTimer > 0) {
myTimer -= Time.deltaTime;
}
//when the timer ends, this animation plays
if (myTimer <=0) {
animation.PlayQueued("Exit", QueueMode.CompleteOthers);
}
}
I need to be able to see the animations in the main camera. Please help!!
part of your code formatting went wrong...
anyway, if you cannot see animations, try playing just 1 animation on start or something and see if that one plays.
Also, I think a see a few things happening in OnGUI there that really should not be in OnGUI(). (You should really do UI things only in OnGUI())
All my animations work individually and even work when i play the scene in the scene view, just not the game view. What do you mean by not be in the OnGUI?
for example you update a timer in OnGUI, you should do that sort of thing in Update().
As for your question...
If you cannot see your character in the game view, is it located in front of the camera?
Put another way, what are the positions of your character and of your camera?
the idea is that the character walks into the view of the camera from the left, however to check it works i moved the camera to where the character starts. I can see the model and it tries to start the animation but then stops, like it glitching?
Answer by Alecmac · May 14, 2015 at 04:27 PM
I have tested each animation on thier own and they work (without using code) and they can be seen in the camera. When I put them into code is when it becomes invisible? As for the GUI i need an interactive button on screen that can be pressed, this would then play the answer animation before going back to the beginning of the Idle animation.
Your answer
Follow this Question
Related Questions
how character's legs(tps) move? 0 Answers
How would you make a shapeshifting mechanic in a game? 1 Answer
How to fix Animation 1 Answer
Why isn't my animation being played? 0 Answers