Is it possible to dynamically use GetComponent to retrieve a variable (VideoClip) with another string variable? Say I would want to change the video clip of a video player in another game object, but all video clips are stored in another script. So if I had video1, video2, and video3 in the “VideoManager” game object, and I would want to retrieve those VideoClip variables via a string (videoName) instead of an explicit variable name (video1), how could I go about that? Let me know if I need to add onto this quesion.
**Example: **
string videoName = "video1"; GameObject.Find("VideoManager").GetComponent().videoName; Does not work
I would like this to be equivalent to…
GameObject.Find("VideoManager").GetComponent<VideoManager>().video1; Works
Any help or pointers would be useful!