Particle Play() doesnt work when calling from the prefabs parent
 GetComponent<PlayerInit>().GetCurrentHull().GetComponent<HullControl>().FireMuzzle();
This line of code is in a script attached to a prefab GameObject "Player". So is the PlayerInit script. GetCurrentHull() returns an instanciated Hull prefab GameObject. Hull control script:
 using UnityEngine;
 public class HullControl : MonoBehaviour {
     public ParticleSystem muzzleFlash;
     void Update() {
         if(Input.GetKeyDown(KeyCode.T)) {
             muzzleFlash.Play();
         }
     }
     public void FireMuzzle() {
         muzzleFlash.Play();
         Debug.Log("FireMuzzle() Called");
     }
 }
Particle system is played when T is pressed, but isnt when FireMuzzle() is called. I know that the method is being called because of the Debug.log(). So this really blows my mind. After about an hour of research, this is my final hope. Thanks.
After a long debugging session I've decided to for a cheap work around of accessing the component directly like so: transform.GetChild(0).GetChild(3).GetChild(0).GetChild(3).GetChild(0).GetComponent().Play();
Its not pretty, but it works...
Your answer
 
 
             Follow this Question
Related Questions
Changing a Prefab's Text component seems to be broken. 1 Answer
How do you set Prefabs into a GameObject array that will activate/deactivate when called? 1 Answer
How to creating a Gameobject from a prefab via scripted UI BUTTON 1 Answer
Create gameobject in other scene... 0 Answers
Drag and Drop 3D objects. 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                