Skip to content

UnityException - Calls not allowed from constructor  #218

@sarbian

Description

@sarbian

While looking at the FS loading error I saw a bunch of Unity message about method calls that are not allowed form a constructor. Here is a few

UnityException: Find is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'FScameraToTV' on game object 'FScockpitTV'.
See "Script Serialization" page in the Unity Manual for further details.
FScameraToTV..cctor () (at :0)
Rethrow as TypeInitializationException: The type initializer for 'FScameraToTV' threw an exception.
UnityEngine.GameObject:AddComponent(Type)
InternalProp:AddModule(String)
InternalProp:AddModule(ConfigNode)
InternalProp:Load(ConfigNode)
PartLoader:LoadInternalProp(UrlConfig)
d__75:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

UnityException: Internal_CreateGameObject is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'FSgroundParticles' on game object 'FScopterRotorMain'.
See "Script Serialization" page in the Unity Manual for further details.
UnityEngine.GameObject..ctor () (at C:/buildslave/unity/build/Runtime/Export/Scripting/GameObject.bindings.cs:359)
Firespitter.engine.FSgroundParticles..ctor () (at :0)
UnityEngine.GameObject:AddComponent(Type)
Part:AddModule(String, Boolean)
Part:AddModule(ConfigNode, Boolean)
PartLoader:ParsePart(UrlConfig, ConfigNode)
d__56:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

UnityException: Internal_CreateGameObject is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'FSmultiAxisEngine' on game object 'FSswampEngine'.
See "Script Serialization" page in the Unity Manual for further details.
UnityEngine.GameObject..ctor () (at C:/buildslave/unity/build/Runtime/Export/Scripting/GameObject.bindings.cs:359)
Firespitter.engine.FSmultiAxisEngine..ctor () (at :0)
UnityEngine.GameObject:AddComponent(Type)
Part:AddModule(String, Boolean)
Part:AddModule(ConfigNode, Boolean)
PartLoader:ParsePart(UrlConfig, ConfigNode)
d__56:MoveNext()

UnityException: Internal_CreateGameObject is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'FSVTOLrotator' on game object 'FSVTOLengine'.
See "Script Serialization" page in the Unity Manual for further details.
UnityEngine.GameObject..ctor () (at C:/buildslave/unity/build/Runtime/Export/Scripting/GameObject.bindings.cs:359)
Firespitter.engine.FSVTOLrotator..ctor () (at :0)
UnityEngine.GameObject:AddComponent(Type)
Part:AddModule(String, Boolean)
Part:AddModule(ConfigNode, Boolean)
PartLoader:ParsePart(UrlConfig, ConfigNode)
d__56:MoveNext()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions