Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  4. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

Space Shooter Tutorial Q&A

Discussion in 'Community Learning & Teaching' started by Adam-Buckner, Mar 26, 2015.

  1. Tradge20

    Tradge20

    Joined:
    Feb 9, 2018
    Posts:
    4
    can I do this tutorial without switching to webGL? I have 32 bit windows and I can't use WebGL.
     
  2. Tradge20

    Tradge20

    Joined:
    Feb 9, 2018
    Posts:
    4
    I can't use WebGL being I'm on windows with 32 bit. can I use this tutorial with another build?
     
  3. Artermis

    Artermis

    Joined:
    Feb 11, 2018
    Posts:
    2
    I am on the tutorial shooting shots. I have done everything in the tutorial, set everything the way the guy says it too. I get one perfect bolt and then the rest fire in a laser like way with pretty much no space between them. I have rechecked my code and I even changed the timing for the firing seeing if I could fix it in the game instead of the code but the same thing is happening. Please help. Never mind. I found the issue. I had an extra semicolon somewhere it wasn't supposed to be
     
    Last edited: Feb 13, 2018
  4. Bragou

    Bragou

    Joined:
    Feb 13, 2018
    Posts:
    1
    Hi there !
    I'm on the "Game Controller" part, and I wonder why we use "Quaternion.identity".
    My game is working the same way if I write :

    Quaternion spwanrotation = new Quaternion();
    or
    Quaternion spawnRotation = Quaternion.identity;

    Oh and an other question : Why do we have to first declare a variable at the root of our script then initialize it in the start function ? Why can't we just declaring AND initializing in the same sentence ? In other words why do we do that :

    private int score;
    void Start ()
    {
    score = 10;
    }

    rather than that :

    private int score = 10;
     
    Last edited: Feb 13, 2018
  5. E2max007

    E2max007

    Joined:
    Jan 18, 2018
    Posts:
    1
    @Tradge20 I doing this tutorial at the moment and I guess you can do it for any platform you want. I think you can do it for windows standalone.

    @Bragou To answer you second question:
    Meet Score the variable. His job is to remember something. First we call him to the scene: Score get you ass over here. After a while we say: score remember this: 10! When we have scored more points we increase it: now remember 1000.

    I am not sure how Unity handles the placement of variable in a script and depending in what class they are. I think its possible to declare score with a value of 10. But then at the moment its declared the score will already be 10.
    And if you would declare the score every time the scores increases the score doesn't increases but just gets changed out by another score "guy".

    Does this help?
     
  6. aboogieman

    aboogieman

    Joined:
    Oct 6, 2017
    Posts:
    8
    On your first question, the only reason to use the Quaternion() constructor is to provide one of the X, Y, or Z values. If you provide none, I believe the result is the same as Quaternion.Identity – i.e., Quaternion.Identity simply returns a Quaternion created with the default constructor.

    On your second question, you're basically asking why C# syntax is that way. Perhaps you need to solidify your C# skills? (Or merely accept this answer, if that's all you need.) More specifically, a static variable is much different than a member variable (field)!
     
  7. aboogieman

    aboogieman

    Joined:
    Oct 6, 2017
    Posts:
    8
    WebGL is definitely cross-platform and I know it's available on Windows 32 bit. So I have no idea why you can't use it in Windows 32 bit.

    I guess it's just that Unity doesn't support that??? Anyone?
     
  8. aldab

    aldab

    Joined:
    Sunday
    Posts:
    1
    Hi
    I wanted to know why doesn't this code Destroys the shot :
    Code (CSharp):
    1.  if (shot.transform.position.z >= boundary.zMax )
    2.             Destroy(shot);
    3.          
    4.  
    I Understand the code written in the tutorial, but I wanted to try another way
    Thank You!
     
    Last edited: Feb 18, 2018 at 2:27 PM
  9. mikemcbrien

    mikemcbrien

    Joined:
    Sunday
    Posts:
    1
    Hey I'm also new to Unity. I found that I had added a slight tilt to my ship when moving forwards or backwards. This caused the bolts fired to move in the Y direction (not noticeable to the game camera), and exit the boundary and be removed before leaving the screen.
     
  10. Ferrim

    Ferrim

    Joined:
    Sunday
    Posts:
    2
    Please help.
    What's wrong with these bolts?

    It looks like they are stretched from the z-axis to the x-axis.
    Although if you put the camera on top then everything is ok.
     

    Attached Files:

    Last edited: Feb 18, 2018 at 11:01 PM
  11. garethsparks

    garethsparks

    Joined:
    Tuesday
    Posts:
    1
    I just finished part 7 and my shots are rotating on the X axis along with the normal ship tilt applied in the tutorial. I am sure I can figure out how I'd fix this, but I want to know if I missed a step in the tutorial (best practices and all) or if this is something the creator didn't account for.

    EDIT: from looking at the done copy, it doesn't seem fixed? Shot is being instantiated with shotSpawn.rotation. It should be some version of shotSpawn.rotation with the X rotation zeroed out, right? I haven't tested the "done" project yet (not sure how yet) to see if it's visible. I just want to be sure there isn't some other setting I'm missing.
     
    Last edited: Feb 20, 2018 at 3:05 AM
  12. Ferrim

    Ferrim

    Joined:
    Sunday
    Posts:
    2
    This is not rotation. May be camera views?
    Because from topview camera it looks fine.
     
  13. crkobel

    crkobel

    Joined:
    Thursday
    Posts:
    1
    In the first section to set up your project when you select your "build target", web player is not one of the listed options. The ones that are available are the default (PC, mac and linux standalone), iOS, universal windows platform, webGL, tvOS, android, xbox one, PS vista, ps4 and facebook. Which one should I select? or do I just leave it as the default?
     
  14. Alexgwenn

    Alexgwenn

    Joined:
    Feb 11, 2018
    Posts:
    1
    Is there sample code to respawn the player a number of times before the game is over?

    Im guessing the player would have to be converted to a prefab and the GameController script and DestroyByContact script would need to be altered.
     
  15. totemh

    totemh

    Joined:
    Jan 30, 2018
    Posts:
    1
    Try adding a "GUI Layer" component to the Main Camera Game object.