space shooter asteroids are invisible
When I play the game, the asteroids are invisible, even though the asteroid prefabs are getting added and removed from my hierarchy.
This is my Mover.cs script:
public class Mover : MonoBehaviour {
private float acceleration = 1f;
public float speed;
public float maxSpeed = 10f;
private Rigidbody rb;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody> ();
rb.velocity = transform.forward * speed; // transform.forward represents foward movement along the z-axis
Debug.Log ("asteroid is moving");
}
// Update is called once per frame
void Update () {
// Add acceleration to speed
speed += Time.deltaTime * acceleration;
// Set object velocity
rb.velocity = transform.forward * speed;
// Check to make sure speed is under top speed
if (speed > maxSpeed) {
speed = maxSpeed;
}
}
}
Is there anything else that would be helpful for me to provide?
Answer by Backside2357 · Jan 04, 2018 at 06:02 PM
Why do you think this script has anything to do with visibility? Are there differences between Edit and Play mode? How are the prefabs instanciated? The information you provide is not sufficient to even understand what you are asking.
Your answer
Follow this Question
Related Questions
[tutorial - Space Shooter] about smoothing in EvasiveManeuver.cs 2 Answers
Unity crashes because of a certain function 0 Answers
script causes unity to crash 0 Answers
Vector3 does not contain a constructor that takes 4 arguments 0 Answers
space shooter tutorial issue "Ending the game" unity 2018.2 b 1 Answer