9using System.Collections;
10using System.Collections.Generic;
22 [AddComponentMenu(
"")]
31 private GameObject _spawnedObj;
34 bool justSpawned =
false;
35 if (_spawnedObj ==
null) {
36 _spawnedObj = GameObject.Instantiate(
toSpawn);
41 || (_spawnedObj.transform.position -
spaceship.transform.position).z < -1F) {
43 if (justSpawned) _spawnedObj.transform.position += Vector3.forward * 2F;
47 private void setSpawnPosition() {
48 Vector3 spawnPos =
spaceship.transform.position;
51 _spawnedObj.transform.position = spawnPos;
This script keeps a GameObject in front of the ship, off to the side a bit. The skybox cannot provide...
float forwardSpawnMultiplier
The spaceship in this example is a kinematic rigidbody with a force API, but having a rigidbody on yo...