division yields zero

var Columns:float;
private var frameWidth:float=(1.0/Columns);

With the Columns var set to 6 in the inspector this yields Infinity.

var Columns:float=6.0;
private var frameWidth:float=(1.0/Columns);

This is great though. Does setting a float value in the inspector automatically change it to an int? Is the some way to manually cast it back?

Are you sure it’s not some other part of an equation that is returning the value infinity?

Yeah, I’m debug.log()'ing right underneath those lines.

In that case, you must be doing it like this :

 var Columns : float;
 private var frameWidth : float = ( 1.0 / Columns );
 
 function Start() 
 {
      //var frameWidth : float = ( 1.0 / Columns );
      Debug.Log( "Columns " + Columns + " : frameWidth " + frameWidth );
 }
 
 // Columns 6 : frameWidth 0.1666667 :- this is printed with var inside start function

 // Columns 6 : frameWidth Infinity :- this is printed with var outside any function

I’m pretty sure you cannot run an equation outside of a function. That’s why the above breaks, but the below works :

 var Columns : float;
 function Start() 
 {
      var frameWidth : float = ( 1.0 / Columns );
      Debug.Log( "Columns " + Columns + " : frameWidth " + frameWidth );
 }
 
 // Columns 6 : frameWidth 0.1666667