Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Adding Components to TypeManager in runtime

Discussion in 'Entity Component System' started by Zylkowski_a, Apr 30, 2020.

  1. Zylkowski_a

    Zylkowski_a

    Joined:
    Jul 27, 2019
    Posts:
    157
    Is it possible to add components to TypeManager in runtime? I am making my game moddable and I am struggling because I think it's impossible to load mods before TypeManager is initialized
     
  2. NT_Ninetails

    NT_Ninetails

    Joined:
    Jan 21, 2018
    Posts:
    191
    Code (CSharp):
    1. public void RegisterGenericComponent(object obj)
    2.         {
    3.             try
    4.             {
    5.                 TypeManager.AddNewComponentTypes(obj.GetType());
    6.             }
    7.             catch (Exception e)
    8.             {
    9.                Debug.LogError("RegisterGenericComponentException: "+e.Message+"\n"+e.StackTrace);
    10.             }
    11.         }
    12.  
    I would also take a look at this guide created by Unity
    https://docs.unity3d.com/Packages/com.unity.burst@1.6/manual/docs/ModdingSupport.html