I am trying to convert this JS to C#.
this is my JS that i made
#pragma strict
var whateverglow : UnityEngine.Animator;
var hashthingglow : int = Animator.StringToHash("StartGlow");
var logovis : float;
function Start () {
whateverglow = GetComponent("Animator");
}
function Update () {
GetComponent(SpriteRenderer).color.a = logovis; //change logovis variable between 0-1 to tell how clear it is.
whateverglow.SetTrigger (hashthingglow);
}
And this is what I have converted it to but there seems to be a error in line 18 (I'm not too familiar with C#)
using UnityEngine;
using System.Collections;
public class logoclass : MonoBehaviour {
UnityEngine.Animator whateverglow;
int hashthingglow = Animator.StringToHash("StartGlow");
float logovis;
void Start (){
whateverglow = GetComponent();
}
void Update (){
GetComponent().color.a = logovis; //this doesn't seem right.
whateverglow.SetTrigger (hashthingglow);
}
}
The error i get is: C:\Users\Owner\Google Drive\Game\Game\Assets\GameScripts\NewBehaviourScript.cs(3,3): Error CS1612: Cannot modify the return value of 'UnityEngine.SpriteRenderer.color' because it is not a variable (CS1612) (Assembly-CSharp)
↧