Hello
I have a C# script. I am trying to display 5 different variables on 5 different textures. These variables are Damage, FameMultiplier, Speed, Tires and Handling. My code is ` void Update () {
SpeedT.guiTexture.pixelInset.width = (Speed * pixelToLiveRatio1);
DamageT.guiTexture.pixelInset.width = (Damage * pixelToLiveRatio2);
FameMultiplierT.guiTexture.pixelInset.width = (FameMultiplier * pixelToLiveRatio3);
TiresT.guiTexture.pixelInset.width = (Tires * pixelToLiveRatio4);
HandlingT.guiTexture.pixelInset.width = (Handling * pixelToLiveRatio5);
if (carSelected == 0)
{
Speed = 152/404;
Damage = 35/100;
FameMultiplier = 20/100;
Tires = 25/100;
Handling = 35/100;
}
if (carSelected == 1)
{
Speed = 162/404;
Damage = 28/100;
FameMultiplier = 60/100;
Tires = 35/100;
Handling = 50/100;
}
if (carSelected == 2)
{
Speed = 155/404;
Damage = 32/100;
FameMultiplier = 22/100;
Tires = 29/100;
Handling = 42/100;
}`
The error that I keep on getting is error CS1612: Cannot modify a value type return value of `UnityEngine.GUITexture.pixelInset’. Consider storing the value in a temporary variable.
From searching the web and from personal testing I can tell that while it works in Javascript it doesnt work in C#.
Any advice will be appreciated