Question by 
               levjackie14 · Feb 11, 2016 at 10:33 AM · 
                c#unity 5scripting problemnoob  
              
 
              FormatException: Input string was not in the correct format
I am trying to access a method that is in a script attached to a prefab. When I try to run it I get the "FormatException" error. All help appreciated.
Thank you
 void dropDecimal(float inputDecimal){
         
         projectile_pos_fraction fractionScript;
         GameObject dropSmallApple;
         GameObject cube;
 
         dropSmallApple = (GameObject)Instantiate (fractional_apple, ShootPtSecond.transform.position, Projectile_pos.transform.rotation);
 
         fractionScript = dropSmallApple.GetComponent<projectile_pos_fraction>();
         fractionScript.setFillAmount (inputDecimal);
     }
The projectile_pos_fraction script looks like this:
 public class projectile_pos_fraction : MonoBehaviour {
     public float myFillAmount;
     public Text myText;
     
     // Update is called once per frame
     void Update () {
     
         Image image = GetComponent<Image> ();
         image.fillAmount = myFillAmount;
 
     }
 
     public void setFillAmount(float amount){
         myFillAmount = amount;
     }
 }
               Comment
              
 
               
              Prefabs are uninitialised so probably contain no viable data. Initialise your variables with default values. There is no instance in a prefab.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                