The question is answered, right answer was accepted
"Can't add script behaviour AICharacterControl. The script needs to derive from MonoBehaviour!" ?
I'm trying to make a typewriter-like text using another question on here but I keep on getting this pop-up saying I'm not able to do so. How do I fix it?
(EDIT) All of my scripts are doing this within the project! I can't find a way to fix it, and it makes it so I can't work within it- I don't want to get rid of all my progress so far, how do I fix it?
Here's my script:
string[] vicinityText = new string[2]
{
"I see you're unfamiliar with this place... here's some basic enemies. Fight or die trying.",
"Easy enough, right? Now let's test your mathematical knowledge."
};
public Text vicinityTalkBox;
int currentTextDisplayed = 0;
private void Awake()
{
StartCoroutine(AnimateText());
}
IEnumerator AnimateText()
{
for (int x = 0; x < vicinityText[currentTextDisplayed].Length + 1; x++)
{
vicinityTalkBox.text = vicinityText[currentTextDisplayed].Substring(0, x);
yield return new WaitForSeconds(0.3f);
}
}
Answer by Vollmondum · Apr 13, 2019 at 05:19 AM
public class myScript: MonoBehavuour Your script file should also be named myScript. These two should be equal
I checked, they are the same. Thanks for helping though!
Answer by sicklml52_stu · Apr 15, 2019 at 07:50 PM
Okay, I fixed it! Turns out that importing only part of "Standard Assets" leaves your project kinda.. well, broke. It's solved!
Follow this Question
Related Questions
"Can't add script behaviour AICharacterControl. The script needs to derive from MonoBehaviour!" ? 0 Answers
Coroutine Not Starting - Crashes Instead? 1 Answer
What is Coroutine, Yiel and IENumerator? 1 Answer
Any Way to Improve These Scripts or Increase Game Performance? 0 Answers
How can i change the value of a variable from an IEnumerator 0 Answers