Quantcast
Viewing all articles
Browse latest Browse all 83

FixedUpdate only called during InvokeRepeating script

Hi All, I'm creating new GameObjects from a prefab in an InvokeRepeating script. The GameObject's FixedUpdate gets called in early stage of application. As time goes on, the FixedUpdate only gets called after the InvokingRepeapting's script. public GameObject sonarWavePrefab; void Start() { InvokeRepeating( "sendPing", 0.0f, frequencyInSeconds ); } public void sendPing() { // add a new wave to the system // it starts from the transmitters position. Vector3 transmitterPostion = new Vector3( this.gameObject.transform.position.x, this.gameObject.transform.position.y, this.gameObject.transform.position.z ); Quaternion transmitterRotation = new Quaternion(this.gameObject.transform.rotation.x, this.gameObject.transform.rotation.y, this.gameObject.transform.rotation.z, this.gameObject.transform.rotation.w); // Cast exception //GameObject waveGO = (GameObject) Instantiate( sonarWavePrefab, // original : Object, Instantiate( sonarWavePrefab, // original : Object, transmitterPostion, // position : Vector3, transmitterRotation ); // rotation : Quaternion) : Object sonarWavePrefab.name = "Ping at: " + Time.time + " from: " + this.gameObject.name; SonarWave wave = sonarWavePrefab.gameObject.GetComponent(); wave.startTimeInSeconds = Time.time; // wave to have energy of transmitter wave.energy = this.power; Debug.Log( "sendPing() at " + Time.time ); Debug.Log( "Instantiate(): " + sonarWavePrefab.gameObject ); } Other symptoms. The new GameObjects no longer appear in the Hierarchy as time goes on. The name of the prefab gets changed in edit with runtime names I assign to new instances. Thanks

Viewing all articles
Browse latest Browse all 83

Trending Articles