- Home /
Second "void Start()" not being called
Hi, I'm very new to Unity and was trying to create a script. Was wondering why the second void Start() isn't working. I know I can divide them in two scripts but I was wondering if I could keep it as one.
Here's my Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FirstClass : MonoBehaviour
{
void Start()
{
Debug.Log("hello");
}
}
public class SecondClass: MonoBehaviour
{
void Start()
{
Debug.Log("world");
}
}
So the problem is that "World" is not being printed Thanks for any help.
Answer by unity_ek98vnTRplGj8Q · Dec 23, 2019 at 08:37 PM
Unity doesn't like two monobehaviors in one script it looks like. I believe you will have to put each class into its own file for this to work.
Your answer

Follow this Question
Related Questions
How do I make to print something in console on Unity 5.3 1 Answer
Changing coding language from Xcode to visual studios messed up scripts 0 Answers
Play Animation several times 0 Answers
How to check variables from other scripts 0 Answers
How do I make a script that will allow my character to shoot projectiles? 1 Answer