Search Unity

Space Shooter Tutorial Q&A

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

  1. Trentakill

    Trentakill

    Joined:
    Jun 16, 2018
    Posts:
    2
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.SceneManagement;
    3. using System.Collections;
    4. using UnityEngine.UI;
    5.  
    6.  
    7. public class GameController : MonoBehaviour {
    8.  
    9.     public GameObject[] hazards;
    10.     public Vector3 spawnValues;
    11.     public int hazardCount;
    12.     public float spawnWait;
    13.     public float startWait;
    14.     public float waveWait;
    15.  
    16.     public Text scoreText;
    17.  
    18.     private bool gameOver;
    19.     private bool restart;
    20.     private int score;
    21.  
    22.     void Start() {
    23.         score = 0;
    24.     }
    25.  
    26.     IEnumerator SpawnWaves() {
    27.         yield return new WaitForSeconds(startWait);
    28.         while (true) {
    29.             for (int i = 0; i < hazardCount; i++) {
    30.                 GameObject hazard = hazards[Random.Range(0, hazards.Length)];
    31.                 Vector3 spawnPosition = new Vector3(Random.Range(-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
    32.                 Quaternion spawnRotation = Quaternion.identity;
    33.                 Instantiate(hazard, spawnPosition, spawnRotation);
    34.                 yield return new WaitForSeconds(spawnWait);
    35.             }
    36.             yield return new WaitForSeconds(waveWait);    
    37.         }
    38.     }
    39.     public void AddScore(int newScoreValue) {
    40.         score += newScoreValue;
    41.         UpdateScoreText();
    42.     }
    43.     void UpdateScoreText() {
    44.         scoreText.text = "Score: " + score;
    45.     }
    46. }
    I've recently started a game development course that uses unity and they said to do several of the tutorials on the unity website, i'm stuck on "Counting points and displaying the score"the videos are using unity 4, the update manual is for unity 5 (it has helped a bit already) but I'm using unity 2018, I can't add the empty game object with the GUIText component, but i can add a UI text game object but the code doesn't seem to work, if there are errors i can't see in the code, can you please tell me, thank you
     
  2. ormtheworm23

    ormtheworm23

    Joined:
    Jun 24, 2018
    Posts:
    2
    Same issue started recently with unity 2018 doing Space shooter as far as I can see I have written pretty much the same code to circumvent the GUItext (which is not possible to use anymore) in my case its working fine. I ll try to upload my code so you can compare
     

    Attached Files:

  3. ormtheworm23

    ormtheworm23

    Joined:
    Jun 24, 2018
    Posts:
    2
    Finished Space Shooter by creating the build (WebGL) in Unity 2018 looks a bit different to the video in the tutorial and it took quite long to be done (i 'm not shure might be due to a problem with windows). Can anybody explain the differences?
     
  4. CorruptedStudiosEnt

    CorruptedStudiosEnt

    Joined:
    Jun 29, 2018
    Posts:
    1
    Hello. I ran into a strange problem just after beginning the Extended Space Shooter tutorial section. The only things I modified was adding in the new asteroid prefabs, changing the code as directed to make them functional, and applied it to the inspector of the Game Controller in Hierarchy. Before starting this tutorial, everything worked exactly as planned. As soon as I did those few things and pressed play, I noticed many of my asteroids wind up moving on the X and Y axis when so far as I'd known they'd only been set to move down the Z with the mover script. I know they're also using the Y axis because they are going over and under my ship, evidenced by the fact they'll pass right by. It's not every asteroid either, maybe up to 25%-50% per wave. I found another issue posted somewhere else where not having the collider set to "Is Trigger" caused it because they were bouncing off of each other, but I have that checked on all 3. I'm out of ideas as to what could be causing it. Here's the only script that was modified at this point. Any ideas?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using UnityEngine.SceneManagement;
    6.  
    7. public class GameController : MonoBehaviour
    8. {
    9.     public GameObject[] hazards;
    10.     public Vector3 spawnValues;
    11.     public int hazardCount;
    12.     public float spawnWait;
    13.     public float startWait;
    14.     public float waveWait;
    15.  
    16.     public Text scoreText;
    17.     public Text restartText;
    18.     public Text gameOverText;
    19.  
    20.     private bool gameOver;
    21.     private bool restart;
    22.     private int score;
    23.  
    24.     void Start ()
    25.     {
    26.         gameOver = false;
    27.         restart = false;
    28.         restartText.text = "";
    29.         gameOverText.text = "";
    30.         score = 0;
    31.         UpdateScore ();
    32.         StartCoroutine (SpawnWaves ());
    33.     }
    34.  
    35.     void Update ()
    36.     {
    37.         if (restart)
    38.         {
    39.             if (Input.GetKeyDown (KeyCode.R))
    40.             {
    41.                 SceneManager.LoadScene("Main");
    42.             }
    43.         }
    44.     }
    45.  
    46.     IEnumerator SpawnWaves ()
    47.     {
    48.         yield return new WaitForSeconds (startWait);
    49.         while (true)
    50.         {
    51.             for (int i = 0; i < hazardCount; i++)
    52.             {          
    53.                 GameObject hazard = hazards[Random.Range (0,hazards.Length)];
    54.                 Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
    55.                 Quaternion spawnRotation = Quaternion.identity;
    56.                 Instantiate (hazard, spawnPosition, spawnRotation);
    57.                 yield return new WaitForSeconds (spawnWait);
    58.             }
    59.             yield return new WaitForSeconds (waveWait);
    60.          
    61.             if (gameOver)
    62.             {
    63.                 restartText.text = "Press 'R'";
    64.                 restart = true;
    65.                 break;
    66.             }
    67.         }
    68.     }
    69.  
    70.     public void AddScore (int newScoreValue)
    71.     {
    72.         score += newScoreValue;
    73.         UpdateScore ();
    74.     }
    75.  
    76.     void UpdateScore ()
    77.     {
    78.         scoreText.text = "Score: " + score;
    79.     }
    80.  
    81.     public void GameOver ()
    82.     {
    83.         gameOverText.text = "Game Over!";
    84.         gameOver = true;
    85.     }
    86. }
    87.  
    EDIT: Okay so I kept investigating and found that when I put an instance of Asteroid02 into the Hierarchy, and moved it to origin, it was a good distance off the left edge of the screen. Didn't have any other transform properties aside from a distance back at Z, so I'm still not quite sure what caused it, but I completely remade the prefab off of my Asteroid01 prefab just replacing the model and collider and that worked. No more zooming asteroids going every which direction.
     
    Last edited: Jul 7, 2018
  5. JollyByte

    JollyByte

    Joined:
    Jul 6, 2018
    Posts:
    4
    Hi all, I am stuck trying to constraint the player ship to the game area - Boundaries. Currently receiving error:

    Assets/Scripts/PlayerController.cs(43,17): error CS1644: Feature `tuples' cannot be used because it is not part of the C# 4.0 language specification
    Any advice? I noticed this project is old, anyone recommend a more current project?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. [System.Serializable]
    6. public class Boundary
    7. {
    8.     public float xMin, xMax, zMin, zMax;
    9. }
    10.  
    11. public class PlayerController : MonoBehaviour {
    12.     private Rigidbody rb;
    13.     void Start()
    14.     {
    15.         rb = GetComponent<Rigidbody>();
    16.     }
    17.  
    18.     public float speed;
    19.     public Boundary boundary;
    20.  
    21.     void FixedUpdate()
    22.     {
    23.         float moveHorizontal = Input.GetAxis("Horizontal");
    24.         float moveVertical = Input.GetAxis("Vertical");
    25.  
    26.         Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    27.         rb.velocity = movement * speed;
    28.  
    29.         rb.position = new Vector3
    30.             (
    31.             Mathf.Clamp, (rb.position.x, boundary.xMin, boundary.xMax),
    32.             0.0f,
    33.             Mathf.Clamp, (rb.position.z, boundary.zMin, boundary.zMax)
    34.             );
    35.     }
    36.  
    37. }
    38.  
    39.  
     
  6. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    To start with, remove the comma after Mathf.Clamp at lines 31 and 33 so it becomes
    Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),




    I'm also a little confused by the error message you saw:
    Assets/Scripts/PlayerController.cs(43,17):
    I was under the impression the first number in the error (43 in this case) was the line number the error occurred at. Your code dosen't even go that high. I thought the second number (17 in this case) is the character position of the error
     
    Last edited: Jul 9, 2018
    JollyByte likes this.
  7. JollyByte

    JollyByte

    Joined:
    Jul 6, 2018
    Posts:
    4
    I had cleaned out a lot of the comments I had (as I am learning, I like to //comment) reason for the code line being much further down. Thanks for a fast response, that was exactly the issue - the comma. First time I learn all this terminology of 'tuples'. :)
     
  8. JollyByte

    JollyByte

    Joined:
    Jul 6, 2018
    Posts:
    4
    Just wanted to share this correction with everyone; based on the guide it wanted us to use void Start() for the Creating Shots however the correction is void Update(). So I am new, I don't understand yet what the difference is but when looking into the script reference of transform-forward it provided me with that clue.

    void Start - when ever I tried to fire, the shots would stay in the same position from where I fired them - shots were frozen.
    void Update - did what it's supposed to - fire shots forwarded at the set speed (20) and no longer frozen.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Mover : MonoBehaviour {
    6.     private Rigidbody rb;
    7.     public float speed;
    8.     void Update()//if using void Start() then nothing will happen - error on Unity Guide?
    9.     {
    10.         rb = GetComponent<Rigidbody>();
    11.         rb.velocity = transform.forward*speed; //the local Z Axis of an object is known as a Transform Forward
    12.     }
    13.  
    14. }
    EDIT: So in the Explosions video we have to use this same script again on the Asteroid. How ever, it only works properly if I change the script to void Start() and not void Update()
     
    Last edited: Jul 27, 2018
    lilspartan99 likes this.
  9. AyroV

    AyroV

    Joined:
    Jul 16, 2018
    Posts:
    1
    I builded the game for windows and it works for me without problem but when i send my built folder to my friend he gets this screen for a second and nothing afterwards.

    This is the log he receives with development build.

    Code (CSharp):
    1. Mono path[0] = 'C:/Users/arda1/Desktop/Game2/Space_Shooter_Data/Managed'
    2. Mono config path = 'C:/Users/arda1/Desktop/Game2/Mono/etc'
    3. PlayerConnection initialized from C:/Users/arda1/Desktop/Game2/Space_Shooter_Data (debug = 0)
    4. PlayerConnection initialized network socket : 0.0.0.0 55062
    5. Multi-casting "[IP] 192.168.2.28 [Port] 55062 [Flags] 3 [Guid] 3166932050 [EditorId] 1786920564 [Version] 1048832 [Id] WindowsPlayer(DESKTOP-EGJNDGI) [Debug] 1 [PackageName] WindowsPlayer" to [225.0.0.222:54997]...
    6. Waiting for connection from host on [0.0.0.0:55062]...
    7. Timed out. Continuing without host connection.
    8. Started listening to [0.0.0.0:55062]
    9. Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56050
     
  10. steveeltham

    steveeltham

    Joined:
    Jun 27, 2018
    Posts:
    4
    Hi. I'm having trouble with SimpleTouchpad.cs. the variable 'direction' is being updated in the OnDrag() function but then the same variable has a value of (0,0) in GetDirection(). I've added a couple of debug.logs to view the contents of direction. Can anyone help please?

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using UnityEngine.EventSystems;
    6.  
    7. public class SimpleTouchpad : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler {
    8.  
    9.     public float smoothing;
    10.  
    11.     private Vector2 origin;
    12.     private Vector2 direction;
    13.     private Vector2 smoothDirection;
    14.  
    15.     void Awake()
    16.     {
    17.         //direction = Vector2.zero;
    18.         Debug.Log("Hi");
    19.     }
    20.  
    21.     public void OnPointerDown(PointerEventData data)
    22.     {
    23.         // set start point
    24.         origin = data.position;
    25.     }
    26.  
    27.  
    28.     public void OnDrag(PointerEventData data)
    29.     {
    30.         // compare difference between start point and current point
    31.         Vector2 currentPosition = data.position;
    32.         Vector2 directionRaw = currentPosition - origin;
    33.         Vector2 direction = directionRaw.normalized;
    34.         Debug.Log("in function ondrag.  direction=" + direction);
    35.     }
    36.  
    37.     public void OnPointerUp(PointerEventData data)
    38.     {
    39.         // reset everything
    40.         direction = Vector2.zero;
    41.     }
    42.  
    43.     public Vector2 GetDirection()
    44.     {
    45.         Debug.Log("in function GetDirection. direction: " + direction);
    46.         smoothDirection = Vector2.MoveTowards(smoothDirection, direction, smoothing);
    47.         return smoothDirection;
    48.     }
    49. }
     
  11. Wixelt

    Wixelt

    Joined:
    Sep 30, 2016
    Posts:
    2
    Unrelated to any actual programming, but I wasn't sure where else to put this, given it happened on one of the pages for the Space Shooter tutorial (i'll relocate this message if requested).

    Upon loading the 'Building the Game' tutorial page to run through, rather than loading the usual YouTube player, as I was expecting, the site pulled up a Chinese video embed in its place that I had to specifically enable Flash Player for. On top of that, I can't even tell if it loaded the correct video, as it's showing me the final 'building game' video for the Roll A Ball tutorial (which could just be a reuse because the process is the same, but with the unexpected video player, i'm really not sure.

    Has anyone else had this happen to them. I'm incredibly confused right now.

    -Wixelt
     
  12. steveeltham

    steveeltham

    Joined:
    Jun 27, 2018
    Posts:
    4
    I just noticed I was redefining direction as a vector2 in the OnDrag() function. I've corrected that and finally the ship is moving.
     
  13. steveeltham

    steveeltham

    Joined:
    Jun 27, 2018
    Posts:
    4
    Hi. Are you loading the tutorial via the link in the readme file in the Unity space shooter project? I just re-tried that and it seems fine.
     
  14. Wixelt

    Wixelt

    Joined:
    Sep 30, 2016
    Posts:
    2
    Actually, I was loading it via the links on the site itself, which is still turning up the same Chinese video player. I didn't know there was a read-me file, so I might take a look at that now.
     
  15. tompave

    tompave

    Joined:
    Aug 28, 2017
    Posts:
    8
    I've had the same problem.
    To get ublocked, the _actual_ video for lesson 5 can be watched directly on YouTube.

    More info:

    This happens with the link from the Unity website.

    For me it plays some Chinese commercials that I cannot skip, and clicking them tries to redirect me to `admaster.cn`. They're HTML5 video for me though, not Flash.

    If I let them play till the end it will finally play a unity tutorial video, except that it's the wrong one.
    It's meant to be the "Moving the Player" video from the "Roll a Ball Tutorial", except that it's actually a copy of the original video with extra Chinese subtitles and logos.

    The `src` from the `<video>`, if anyone is curious:

    http://vhotakamai.video.gtimg.com/n...010&amp;guid=aff8b052463b9f7d0d60e741b6ead6bc
     
  16. parhamfartoot

    parhamfartoot

    Joined:
    Aug 1, 2018
    Posts:
    2
    I'm fairly new to using unity engine and game development in general and i'm having a problem with the space shooter program.
    I have finished the project ( with enemy space ships and etc.) and every thing works completely fine when I run the game in unity(2018.2.1f1 personal). The problem is when I build the game for WebGL and run it, the enemies ships destroy them selves as soon as they fire bullets.I'm really confused why the game works completely fine in unity and not on the web player.
    I would truly appreciate any kind of help or advice in regards to what could have caused this
     
  17. gca4624

    gca4624

    Joined:
    Aug 2, 2018
    Posts:
    1
    So I'm going through the tutorial currently and I seem to have hit a wall. I'm on 7. "Shooting Shots" and I've gotten it to the point where the bolts are cloned and added to the hierarchy and they are able to move on their own along the z-axis, but they aren't visible. It doesn't give me any errors in unity and nothing seems to be out of place at this point when cross referencing with the completed scripts and scene. Any help would be appreciated.
     
  18. lilspartan99

    lilspartan99

    Joined:
    Jul 22, 2018
    Posts:
    6
    Just wondering but were the shots visible when you drag the bolt prefab from the Project window into the Hierarchy window in the tutorial before that? I am trying to figure out what might have caused the change if any.
     
  19. lilspartan99

    lilspartan99

    Joined:
    Jul 22, 2018
    Posts:
    6
    I am currently working on the space shooter tutorials and I a creating my hazards but I have a slight problem. I have created my code and as far as I can tell there is no difference between mine and the guide's correction and the video. But here it is
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class Random_Rotator : MonoBehaviour
    6. {
    7.     private Rigidbody rb;
    8.     public float tumble;
    9.  
    10.     private void Start()
    11.     {
    12.         GetComponent<Rigidbody>();
    13.         rb.angularVelocity = Random.insideUnitSphere * tumble;
    14.     }
    15. }
    But it says that I have a "
    NullReferenceException: Object reference not set to an instance of an object
    Random_Rotator.Start () (at Assets/Scripts/Random_Rotator.cs:13)

    And I researched what a NullReferenceException and it says that is when your script code tries to use a variable that isn't set and is referencing an object. But I have not set a variable before and it usually just says something like " Variable "Example" is not set, so I don't know what is wrong with this. Any questions I will answer as soon as I can and ANY help is very much appreciated. Thanks in advance!
     
  20. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    144
    At line 13 you are using an object named rb, specifically you are trying to set its angularVelocity.
    You have correctly declared rb at line 7, but you have not set it to anything, so it is null.
    You want to set it at line 12 with the statement:
    rb=GetComponent<Rigidbody>();
     
  21. lilspartan99

    lilspartan99

    Joined:
    Jul 22, 2018
    Posts:
    6
    Thank you so much, I don't know how I missed that so many times:(.
     
  22. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    I recently purchased this. Are there tutorials anywhere for it?

    For now I want to program this and play it on this. Can anyone tell me how to do this?
     
  23. Brian-Washechek

    Brian-Washechek

    Joined:
    Aug 5, 2015
    Posts:
    846
    And I know I've posted in two spots about this. I'm just awaiting a response.
     
  24. lilspartan99

    lilspartan99

    Joined:
    Jul 22, 2018
    Posts:
    6
    I am new to unity and currently working through the space shooter tutorials and I am on "Counting points and displaying the score" and on the guide it says that at minute 7:15 we would have to create a new game object with a GUIText component but at the very beginning we have to create that. Right? But when I create that I can't even see my GUIText. I thought it was just under the player bc when I go to the scene view the handles for the game object are directly on the space ship. So I deactivated the player and it wasn't under it. Any ideas? If anyone can tell me anything about this I would greatly appreciate it. Thanks in advance.
     
    zvan92 likes this.
  25. lilspartan99

    lilspartan99

    Joined:
    Jul 22, 2018
    Posts:
    6
    I'm not sure if this is any help but this is a page on everything on that asset including project ideas https://starscenesoftware.com/vectrosity.html
     
    Last edited: Aug 10, 2018
  26. lilspartan99

    lilspartan99

    Joined:
    Jul 22, 2018
    Posts:
    6
    So is there a problem in your Destroy on Contact script?
     
  27. qxziuan

    qxziuan

    Joined:
    Aug 11, 2018
    Posts:
    1
    Hi guys. Does anyone have error CS0030: cCnnot convert type 'unityengine.networking.playercontroller' to playercontroller'?

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    [System.Serializable]
    public class Boundary
    {
    public float xMin, xMax, zMin, zMax;
    }
    public class PlayerController : MonoBehaviour
    {
    public float speed;
    public float tilt;
    public Boundary boundary;
    public Rigidbody rb;
    private void Start()
    {
    rb = GetComponent<Rigidbody>();
    }
    void FixedUpdate()
    {
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");
    Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    rb.velocity = movement * speed;
    rb.position = new Vector3
    (
    Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
    0.0f,
    Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax)
    );
    rb.rotation = Quaternion.Euler(0.0f, 0.0f, rb.velocity.x * -tilt);

    }
    }
     
  28. sarrownight

    sarrownight

    Joined:
    Aug 13, 2018
    Posts:
    1
    hi everyone. I'm brand new to unity.trying to get through the first video for space shooter tutorial, however, all of the #2 videos instructions are giving me some difficulties since the versions are difficult. I can't make a new project without losing all the space shooters assets, I can't find the assets when I do make a new project, and when it says to change the platform type "the web" option simply isn't there. any help would be appreciated
     
  29. AvaPL

    AvaPL

    Joined:
    Aug 13, 2018
    Posts:
    2
    Rename your script to PlayerController123 or something like that, somehow "PlayerController" name colides with another file in Lobby folder.
     
  30. herodangau

    herodangau

    Joined:
    Aug 15, 2018
    Posts:
    1
    Hi,
    It seems the video (
    Moving the player
    Checked with version: 5.1

    has been deleted.
    Can you check this?
     
  31. Trentakill

    Trentakill

    Joined:
    Jun 16, 2018
    Posts:
    2
    my computer blew up (i'm using my mother-in-laws), i've lost all my unity data (just three games i made by watching tutorials) I downloaded unity onto her computer and will transfer it to my new one (when i get it) so i'm starting all over again and hopefully this will fix my problem
     
  32. n2fole00

    n2fole00

    Joined:
    Sep 19, 2013
    Posts:
    5
    Edit: Skip to the end. There is an update.

    Hi, I'm at Part 1 Step 5. Video time 6:40

    I'm getting these errors:

    Assets/Lobby/Scripts/Lobby/LobbyManager.cs(266,56): error CS0030: Cannot convert type `UnityEngine.Networking.PlayerController' to `PlayerController'


    Assets/Lobby/Scripts/Lobby/LobbyPlayer.cs(147,56): error CS0030: Cannot convert type `UnityEngine.Networking.PlayerController' to `PlayerController'


    ...and don't really understand what it means.

    Here is my code, which is attached to the Player gameObject. Any idea what is going wrong? Thanks.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class PlayerController : MonoBehaviour {
    6.  
    7.     private Rigidbody rb;
    8.  
    9.     void Start()
    10.     {
    11.         rb = GetComponent<Rigidbody>();
    12.     }
    13.  
    14.     void FixedUpdate()
    15.     {
    16.         float moveHorizontal = Input.GetAxis("Horizontal");
    17.         float moveVertical = Input.GetAxis("Vertical");
    18.  
    19.         Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    20.         rb.velocity = movement;
    21.     }
    22.  
    23. }
    Update:

    After more research, I created a namespace for PlayerController because there is conflict of names.
     
    Last edited: Aug 17, 2018
    MattLottering and deguzman_lj like this.
  33. n2fole00

    n2fole00

    Joined:
    Sep 19, 2013
    Posts:
    5
    Hi, In Part 1 Section 6, Video timestamp 8:24, I'm meant to select Convex in the Capsule Collider component for the Bolt GameObject. However, I don't have that property on the Capsule Collider component.

    What am I missing here? Thanks.
     
  34. AvaPL

    AvaPL

    Joined:
    Aug 13, 2018
    Posts:
    2
    You don't have to set it on capsule collider. You need Convex only on Player's mesh collider.
     
    Last edited: Aug 18, 2018
  35. n2fole00

    n2fole00

    Joined:
    Sep 19, 2013
    Posts:
    5
    Dang, I feel silly now. I was in the Game view and not the Scene view.
     
    Last edited: Aug 19, 2018
  36. ChiliConcarne

    ChiliConcarne

    Joined:
    Aug 21, 2018
    Posts:
    2
    After doing part 1.05 moving the player, it seems there is a small bug (although not game breaking) where the ship seems to nudge against the boundary by 0.1 units whenever the directional button towards that boundary is pushed (the ship moves 0.1 units toward the right when the right arrow key is pressed when the ship is on the rightmost boundary). I have encountered this bug, the bug seems present on the video, and I'm curious whether anyone has a solution to this. I've tried clamping the position at the Update and LateUpdate frame, but it doesn't seem to work.

    -----------UPDATE---------
    It seems that the velocity is the culprit. My guess is that the physics updates the ship's position by 1 frame according to the velocity after fixedupdate. Testing and changing the velocity for each individual boundaries seems to solve the bug. Although I don't know if it is worth it, because the animation seems smooth enough if you combine it with the ship tilting.
     
    Last edited: Aug 22, 2018
  37. HoakinBlackforge

    HoakinBlackforge

    Joined:
    Aug 22, 2018
    Posts:
    1
    Hello, starting with unity with the space shooter project here.

    The tutorial says to set the project as web game type, but i want to make it as a PC project for futher improvement, is there any difference or issues compared when i do it as a web project?

    Also, when i start in the first episode, at 6:10, it has that blue background that doesnt seem to be working to me, i dont know what previous steps has taken, but i cannot seem to find it.
     
    Last edited: Aug 22, 2018
  38. ChiliConcarne

    ChiliConcarne

    Joined:
    Aug 21, 2018
    Posts:
    2
    The blue background is the view seen in the camera, and you can adjust how the empty view looks like by adjusting the camera settings accordingly. In this case, you can set the 'clear flags' tab to 'solid color' (the default was 'skybox' in my case) and set the background color to whatever you like at the tab right below it.
     
  39. AceAllArts

    AceAllArts

    Joined:
    Aug 28, 2018
    Posts:
    1
    Hello i'm a beginner, I was following this tutorial but the line

    rigidbody.velocity does not seem to work.

    I changed it to that one to GetComponent<Rigidbody>() but i'm getting errors.
    It's giving me "No MonoBehaviour script in the file or their names do not match the file name.
    UnityError1.png Is this because of the new update?
     
    Last edited: Aug 28, 2018
  40. InGameGames

    InGameGames

    Joined:
    Mar 3, 2018
    Posts:
    33
    Does anyone know to un-billboard the part_jet_flare? I'm trying to re-orientate this tutorial so that it is still top down but the screen is orientated horizontally rather than vertically. I was able to re-orientate the part_jet_core to match the position of the tail of the fighter by rotating it in the transform -90 degrees on the x axis. This doesn't work on the part_jet_core vfx, what am I missing here?

    upload_2018-8-30_8-33-20.png


    upload_2018-8-30_8-29-33.png

    Edit: I found a solution, edit the render alignment to local and rotate the transform 90 degrees then move it out a little.
     
    Last edited: Aug 29, 2018
  41. p_hebert

    p_hebert

    Joined:
    Nov 5, 2016
    Posts:
    1
    Hello,

    I would like to notify those managing this thread that a copy of this tutorial (or at least something using it's assets) is being sold on the Microsoft store.
     
  42. Boromir_2014

    Boromir_2014

    Joined:
    Jun 7, 2018
    Posts:
    5
    Hello,

    I'm stuck in this tutorial at the lesson 07 "shooting shots". Here is my code:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. [System.Serializable]
    6. public class Boundary
    7. {
    8.      public float xMin, xMax, zMin, zMax;
    9. }
    10.  
    11.  
    12. public class PlayerController : MonoBehaviour
    13. {
    14.     private Rigidbody rb;
    15.  
    16.     public float speed;
    17.     public float tilt;
    18.     public Boundary boundary;
    19.  
    20.     public GameObject shot;
    21.     public Transform shotSpawn;
    22.     private float nextFire;
    23.     public float rateOfFire;
    24.  
    25.     void Upate ()
    26.     {
    27.         if (Input.GetButton("Fire1") && Time.time > nextFire) {
    28.             nextFire = Time.time + rateOfFire;
    29.             Instantiate (shot, shotSpawn.position, shotSpawn.rotation);
    30.         }
    31.  
    32.     }
    33.  
    34.     void Start ()
    35.     {
    36.         rb = GetComponent<Rigidbody> ();
    37.     }
    38.  
    39.     void FixedUpdate ()
    40.     {
    41.         float moveHorizontal = Input.GetAxis ("Horizontal");
    42.         float moveVertical = Input.GetAxis ("Vertical");
    43.  
    44.  
    45.         Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
    46.         rb.velocity = movement * speed;
    47.  
    48.         rb.position = new Vector3(
    49.                 Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
    50.                 0.0f,
    51.                 Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax)
    52.             );
    53.         rb.rotation = Quaternion.Euler(0.0f, 0.0f, rb.velocity.x * -tilt);
    54.     }
    55.  
    56. }
    The problem is my shots are not spawning. I can launch play mode without receiving any error messages, but when pressing left ctrl nothing is being shot.

    Please, help !
     
    Last edited: Sep 1, 2018
    deguzman_lj likes this.
  43. Mark-Sweeney

    Mark-Sweeney

    Joined:
    Feb 21, 2010
    Posts:
    172
    I found this tutorial to be pretty handy. I did find one problem with the _Complete-Game assets.
    Done_Asteroid 01, Done_Asteroid 02, and Done_Asteroid 03 have their colliders on the mesh renderer child object instead of the parent object. So when the asteroids exit the boundary, the Mesh Renderer & Colliders (child) are destroyed, but the parent gameobjects are not.
     
  44. winxalex

    winxalex

    Joined:
    Jun 29, 2014
    Posts:
    166
    you are right
     
  45. Nightmare3711

    Nightmare3711

    Joined:
    Aug 25, 2018
    Posts:
    2
     
  46. Nightmare3711

    Nightmare3711

    Joined:
    Aug 25, 2018
    Posts:
    2
    I can't seem to figure out how to get the resolution to be 600 by 900 from the very first tutorial on the Windows version of Unity 2018.2. I believe that it should work just fine even if it wasn't in those dimensions, but I want to follow the tutorial as close as I can just in case I somehow mess up along the way.
     
    gannbarribon likes this.
  47. deguzman_lj

    deguzman_lj

    Joined:
    Sep 7, 2018
    Posts:
    3
    This is Really helpful, just change the name of PlayerController in public class PlayerController : MonoBehaviour {
     
  48. deguzman_lj

    deguzman_lj

    Joined:
    Sep 7, 2018
    Posts:
    3

    You can fix this by correcting the spelling on line 25 or void Upate () into void Update.
     
  49. deguzman_lj

    deguzman_lj

    Joined:
    Sep 7, 2018
    Posts:
    3

    change the PlayerController to another name like Player
     
  50. harshdulani

    harshdulani

    Joined:
    Sep 3, 2018
    Posts:
    6
    I'm on the Creating Hazards part of the tutorial, have done everything just as the instructor has. Stuck at the part where the asteroid vanishes from the instructor's screen but it doesn't from mine. Any ideas where i should look?

    it rotates well, but nothing gets destroyed - not the bolt, neither the boundary nor the asteroid.

    on unity 2017.3.0