- Home /
Question by
ChrisGermann · Apr 03, 2017 at 02:59 PM ·
scripting problemubuntu
When script is added to object, the script is always empty (Ubuntu problems)
I switched to Ubuntu recently and wanted to start with Unity. Now i watched some Tutorials about Scripting and wanted to add some functionality to a simple sphere. I wrote the script in Atom and added it to a Script folder i generated in the assets. If i drag drop now the script to an object, the script cannot be runned. If i open the script it is always empty. Why is that?
Code i wanted to add:
#pragma strict
// First always define the variables i want to handle with befor starting
// with anything
private var coffeTemperature:float = 85.0f;
private var hotLimitTemperature:float = 70.0f;
private var coldLimitTemperature:float = 40.0f;
function Update()
{
if(Input.GetKeyDown(KeyCode.Space))
TemperatureTest();
coffeTemperature -= Time.deltaTime * 5.0f;
}
function TemperatureTest()
{
//This function is only here to compare given values
if( coffeTemperature > hotLimitTemperature )
{
print![("Coffe is waaaay to hot!");
}][1]
else if( coffeTemperature < coldLimitTemperature)
{
print("Coffe is waaay to cold !");
}
else
{
print("The Coffe is just fine! ");
}
}
[1]: /storage/temp/91209-scriptinobject.png
scriptinfolder.png
(196.8 kB)
scriptinobject.png
(213.6 kB)
Comment
Answer by jwulf · Apr 03, 2017 at 04:17 PM
Maybe this ...
if( coffeTemperature > hotLimitTemperature )
{
print![("Coffe is waaaay to hot!"); // "!" and opening square bracket?
}][1] // closing square bracket followed by index?
... causes a serious parsing error? That would explain at least why the script won't run. Still strange that it's empty upon opening though.