- Home /
How do I get the Play button to work?
This is my first time using Unity, I have created a 3D cube and put a spin script to it so it rotates in place. I went and clicked on the play button to see how it would work but on pressing the play button, nothing happens, no error message or nothing. What am I doing wrong? Please help.
If you are running the project the Play button will be greyed out to show it is running, then chances are your script is not working as intended. Post the code for your spin script inside of the Code Sample tag (101 010 button ).
First it greys out, then when its actually playing the triangle goes blue.
Hi guys thanks for the help but it appears its not about the script not working. Just having a cube without any script and pressing play, im still not getting the play window opening just to get a preview of what I have done. I have tried with other objects that I have brought in from maya but still the play button not playing anything even though I have not put any script to it. Im guessing I should still be able to press the play button and get a preview of my static object but thats not happening in my case. Please help.
Play windows wont open when you click play. your game simply runs in the Game window.
If you arent seeing anything, try repositioning the camera.
$$anonymous$$eant to come back to you guys to let you know that I managed to get my animation working again. Thanks a lot guys for the help.
Answer by meat5000 · Apr 07, 2016 at 04:34 PM
You are totally misconstrued as to what is supposed to happen there.
Pressing play in your Animation import Previewer is not indication of what will happen when you click the Game Play button. You must set up the animation components to utilise the animation clips. They dont just apply automatically.
Your play mode is fully functional and not broken at all.
The "Game" window is the actual game preview.
https://unity3d.com/learn/tutorials/modules/beginner/animation/animator-scripting
Thanks for clarifying about the game window when I press the play button, I get that bit now. I still have the issue of my simple cube not spinning despite following a tutorial https://www.youtube.com/watch?v=2pgbUB$$anonymous$$nbtw (12:29) where he adds a cube and makes it spin. How would you do it if the way I have done it is wrong and also I have been getting some errors about the [VRDevice] initialization of device coculus failed, not sure what this is about. I have done another screen cast explaining this https://youtu.be/p21_U_u4yDE Thanks for the help, I really need it as Im working on a uni project that I need to incorporate all this.
As you have errors in your console it is possible your scripts may not compile at all. Follow the setup guide for your occulus. Clear all errors then try the answer below. Open the console window to see further errors.
Answer by JigneshKoradiya · Apr 07, 2016 at 09:25 AM
create one script : name it ExampleClass and write following code now save it,now go to unity and select cube and now drag that script on inspector so it attach to cube and than press play button of unity it works:
using UnityEngine;
public class ExampleClass : MonoBehaviour {
void Update()
{
// Rotate the object around its local Y axis at 1 degree per second
transform.Rotate(Vector3.right * Time.deltaTime*10);
}
}
Hi guys thanks for the help but it appears its not about the script not working. Just having a cube without any script and pressing play, im still not getting the play window opening just to get a preview of what I have done. I have tried with other objects that I have brought in from maya but still the play button not playing anything even though I have not put any script to it. Im guessing I should still be able to press the play button and get a preview of my static object but thats not happening in my case. Please help.
hi have you put animator on the object that you drag in hierarchy ?
No I havent, how do I do that? See the project I want to do is to bring in an animated object from maya as an FBX which I have done but when it comes to playing the animation in the game window, nothing happens. How do I fix this if it with this animator? All the other tutorials I have seen looked straight forward but just hasent been working for me. How do I do this?
Ok, thanks guys. Ill get on it and see how it goes, thanks a lot for taking the time to respond to my issue. Ill let you all know how I get on. Thanks again.
Im struggling guys the button still doesn't work. Here is a screen cast link at the bottom of whats going on, this might explain my problem better. Ido appreciate all the help, thanks again. https://youtu.be/Zc-LVXxr1Rs
The bottom left windows (Game) is where the gameplay is, where you would expect to see your animation and game play out. The window on the right is an animation preview.
I have not dabbled with animations but you have to tell the game object to play the animation. Check out for more info: https://unity3d.com/learn/tutorials/topics/animation
Follow this Question
Related Questions
Onscreen fire button for FPS games. 1 Answer
Not showing the message in the text field. 1 Answer
Divide the screen to a right and left button 1 Answer
how to add a basic share button android 1 Answer
PlayerPrefs in android 2 Answers