I don’t know C# very well but I have a C# save/load script that I need to use to send info over to my JavaScript. Anyway, this is how I’d write this one line of code in JavaScript:
GameObject.Find("Level").GetComponent("SlotSelection").test = data.completionPercent;
What would be the C# equivalent? The C# script is giving me an error:
(GameObject.Find("Level").GetComponent("SlotSelection") as SlotSelection).test = data.completionPercent;
C# doesn’t automatically cast a Component to the correct type like JavaScript does, so you need to include “as (Whatever)” after your GetComponent calls if you want to use methods or properties other than the base Component ones.
C# does, however, have a generic method for components.
GameObject.Find("Level").GetComponent<SlotSelection>().test = data.completionPercent;