Search Issue Tracker
Won't Fix
Votes
0
Found in
5.0.0f1
Issue ID
676484
Regression
No
Undocumented "Main()" message in MonoBehaviour
How to reproduce:
1. Open a new project
2. Create a script called MainTest.cs with the following code:
using UnityEngine;
using System;
public class MainTest : MonoBehaviour {
void Start () {
Debug.Log ("Start called by " + gameObject.name + "!");
}
void Awake () {
Debug.Log ("Awake called by " + gameObject.name + "!");
}
void Main () {
Debug.Log ("Main called by " + gameObject.name + "!");
}
}
3. Attach the script to any game object in the scene
4. Play the scene
- The log messages are printed in the following order: Awake (gameobject1), Awake (gameobject2), Main (gameobject1), Start (gameobject1), Main (gameobject2), Start (gameobject2)
- The Main method is called after all of the Awake methods are called.
- The Start method is called after the game object's Main method is called.
- The Main method is undocumented.
- We decided to not fix this issue, to avoid potential problems given the fact that "Main" is the name of the default function we generate when compiling UnityScript scripts: if we remove it, nothing is going to work anymore; if we document it, than we will have to maintain and support it forever, which is not something we want to do.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Add comment