Search Unity

Problem with Space Shooter Tutorial

Discussion in 'Scripting' started by ToxicSeaSponge, Sep 25, 2017.

  1. ToxicSeaSponge

    ToxicSeaSponge

    Joined:
    Sep 25, 2017
    Posts:
    6
    Hey guys,
    I have been going through the tutorial and so far have only come across two problems I couldn't find the solution to elsewhere

    1. The player explosion sound refuses to play when it collides with an asteroid, it only plays the asteroid sound but the particle effect goes off.

    2. the scrolling background jumps to 0 on the y covering the scrolling stars and then gets pushed out on the z so that it scrolls back onto the main scene which is just white
    this is the background scroller script if this is a script issue

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class BG_Scroller : MonoBehaviour
    6. {
    7.  
    8.     public float scrollSpeed;
    9.     public float tileSizedZ;
    10.  
    11.     private Vector3 startPosition;
    12.  
    13.     // Use this for initialization
    14.     void Start () {
    15.        
    16.     }
    17.    
    18.     // Update is called once per frame
    19.     void Update ()
    20.     {
    21.         float NewPosition = Mathf.Repeat (Time.time * scrollSpeed,tileSizedZ);
    22.         transform.position = startPosition + Vector3.forward * NewPosition;
    23.     }
    24. }
    25.  
    thanks in advance.