Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Runtime Inspector and Hierarchy [Open Source]

Discussion in 'Assets and Asset Store' started by yasirkula, Oct 22, 2017.

  1. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    151
    Hi again @yasirkula . I'm trying to get the text displayed on buttons to alter depending on whether the button has been clicked or not.

    Code (CSharp):
    1. [RuntimeInspectorButton(GetDrawingString(), false, ButtonVisibility.InitializedObjects | ButtonVisibility.UninitializedObjects)]
    2.     public void EnableDisableEditMode(){
    3.         editModeIsEnabled = !editModeIsEnabled;
    4.     }
    5.  
    6.  
    7.     public string GetDrawingString(){
    8.         if(editModeIsEnabled){
    9.             return "Disable Drawing";
    10.         }
    11.         else{
    12.             return "Enable Drawing";
    13.         }
    14.     }
    From what I've found online, [Attributes] don't accept Methods, but it might be possible to get around this with reflection ( which is beyond my level of expertise! ) see here:- https://stackoverflow.com/questions...method-parameter-into-methods-attribute-value

    Is this the way to go? Or another simpler means I'm not seeing? Thanks again.

    EDIT:

    Question 2. Is there a simple way to hide whole GameObjects from the Inspector? Be nice to be able to drop a script onto them that stops them showing up.
     
    Last edited: Jul 20, 2018
  2. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Customizing the name of RuntimeInspectorButton is a really complicated thing and is not supported right now. It is better to change the label as "Toggle Drawing" until a practical solution is found.

    To hide objects in RuntimeHierarchy, please see this solution: https://github.com/yasirkula/UnityRuntimeInspector/issues/3
     
    wxxhrt likes this.
  3. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    151
    Thanks @yasirkula, for the RuntimeInspectorButton I've just added a bool which provides a bit more visual feedback. And for hiding objects in the RuntimeHierarchy I've changed the following in HierarchyItemTransform.BindTo
    Code (CSharp):
    1.     public void BindTo( Transform target )
    2.         {
    3.             BoundTransform = target;
    4.             nameText.text = target.name;
    5.             //// ****** ADDED THIS BIT ****** ////
    6.             if (target.gameObject.tag == "Hidden"){
    7.                 gameObject.SetActive(false);
    8.             }
    9.             ////
    10.             Refresh();
    11.         }
    Sorry to bombard you but I have two more questions-

    1. I'd like to have all components in the RuntimeInspector automatically expanded after an object has been clicked on in the hierarchy. I’ve been playing with m_isExpanded inside InspectorField.cs but can't get anywhere with it.

    2. When running the build on an iPad the order of objects in the RuntimeHierarchy is jumbled around ( consistently though, not a new jumble every time ) In the editor play mode on a Mac they remain in the correct order though.

    Once again thanks for your time!
     
  4. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Hello again!

    1. Inside GameObjectField.OnBound, you can set a boolean to true and change these lines as following:

    Code (CSharp):
    1. for( int i = 0; i < components.Count; i++ )
    2. {
    3.     var expandable = CreateDrawerForComponent( components[i] ) as ExpandableInspectorField;
    4.     if( boolVariable && expandable != null )
    5.         expandable.IsExpanded = true;
    6. }
    7.  
    8. boolVariable = false;
    2. RuntimeHierarchy sorts Transforms by their sibling indices (Transform sorting). I'm guessing that you are using Alphanumeric sorting in the editor. Alphanumeric sorting in RuntimeHierarchy would be expensive in terms of GC and processor power because each call to GameObject.name generates garbage and the list of transforms would have to be sorted at each refresh.
     
    wxxhrt likes this.
  5. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    151
    Thanks again @yasirkula !

    1. Before you posted I changed ObjectField.cs OnBound() method to the following

    Code (CSharp):
    1. protected override void OnBound()
    2.         {
    3.             elementsInitialized = false;
    4.             base.IsExpanded = true; /// THIS LINE MAKES THE COMPONENTS AUTO EXPAND
    5.             base.OnBound();
    6.         }
    Which seems to have done the trick but I'll revert this and use your code.

    2. I'm not using alphanumeric sorting in the editor, I wasn't very clear.. the order of GameObjects in the editor hierarchy is consistent with what I see in the Game window when I hit play in the editor, the problem occurs when I build to Mac or iPad and run those builds, thats where the order of GameObjects is jumbled around, here's a couple of screenshots Illustrating the problem...





    Should I be using pseudo scenes to add the GameObjects in in the correct order?

    3. I'm going to be using GameObjects with only one Component on them, as such it would be amazing if it is possible to remove both the GameObjectName and Component Name from the RuntimeInspector, make them auto expanded ( done ) and remove their dropdown triangles, basically remove the area highlighted in the below image, likewise for the scene name dropdown in the hierarchy?



    Sorry for asking so many questions in such a quick succession- hope I'm not being too annoying!!
     
  6. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    2. You are right that root scene objects are not necessarily sorted by their sibling indices. Order of root objects is determined by the Scene.GetRootGameObjects function and I'm guessing that it returns objects in different order in a build. For consistency, you'll have to sort the returned list of objects via their sibling indices (i.e. sort Children list at HierarchyRootScene.Refresh function).

    3. You can alter the HierarchyItemRoot and GameObjectField prefabs to disable their dropdown arrows/labels. You shouldn't disable the dropdown arrow of the ObjectField because it would affect all sorts of expandable fields in the inspector. Instead, you can duplicate the ObjectField script and name it ComponentField. Similarly, duplicate the ObjectField prefab and assign ComponentField to it. Then change ComponentField.SupportsType as following:
    return typeof( UnityEngine.Component ).IsAssignableFrom( type );
    . You can modify ComponentField prefab as you like (disable dropdown and label, and etc). Lastly, add ComponentField prefab to your Inspector Settings asset.
     
  7. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    151
    Thanks @yasirkula .

    2. I'm getting weird behaviour on the iPad build still, when I sorted the Children list everything in the Hierarchy disappeared so tried to debug it:-

    Code (CSharp):
    1. public void Refresh()
    2.         {
    3.             Children.Clear();
    4.             Scene.GetRootGameObjects(Children);
    5.  
    6.             foreach (GameObject g in Children)
    7.             {
    8.                 Debug.Log(g.transform.GetSiblingIndex());
    9.             }
    10.         }
    This just logs 0's when running on an iPad, in the editor I get 0-25 so maybe its a Unity bug? Anyway thought I should let you know.

    3. I'll have a crack at this tomorrow.

    Cheers!
     
  8. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
  9. wxxhrt

    wxxhrt

    Joined:
    Mar 18, 2014
    Posts:
    151
    Ah I see! Will try the workarounds mentioned there, thanks.

    Last question!
    Is it possible to use the ColourPickerAlphaSlider.cs as a custom property drawer, and what would be steps to go about doing this? I'd like some floats with the [Range(0,1] Attribute to be exposed as sliders. I see someone asked this earlier but I downloaded the AssetPackage linked and could find anyway to set up a slider.

    Cheers!
     
  10. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    The previous slider issue was actually about using scrollbars in the hierarchy, so that should be of no use in this case. A Range slider would be pretty cool and useful but it will require some code refactoring. The problem is, I am not sure about what the cleanest solution to this problem would be (yet). I'll think about it but I may not add this feature soon because I'm currently focused on another project. In the meantime, feel free to change the code yourself and see if you can implement it on your own.
     
    wxxhrt likes this.
  11. imakki

    imakki

    Joined:
    Feb 19, 2018
    Posts:
    1
    Hi @yasirkula ,

    Greetings of the day!

    First of all, I want to thank you for the work that you are doing for the community. I am using your RuntimeInspector package and it is awesome.

    However, I am having a query regarding adding a field to the inspector of a particular type.

    For example, if we expand the materials property of a mesh, we only have properties like main texture reference picker, main texture colour, etc.

    If I want to add a property like normal map reference picker, etc. How can I do that?
     
  12. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    You can try adding this MaterialField to the Standard Drawers of the InternalSettings asset.

    Please note that Standard shader uses shader keywords to enable/disable several features like normal mapping and emission, so changing the Bump Map from RuntimeInspector may have no effect if _NORMALMAP shader keyword is disabled.
     

    Attached Files:

  13. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    Hi there,
    I hope someone can help me..

    I am using Unity 2018.12.f1 and your runtime inspector asset. When I place the runtime hierarchy prefab to a canvas it appears correctly in runtime, but the runtime inspector (which is also placed in at the canvas) is showing just a grey background.

    My goal is to show Transform status for specific runtime generated objects. Any idea how I can achieve taht?
     
  14. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Make sure to connect the runtime inspector to the runtime hierarchy from the runtime hierarchy's Inspector. Afterwards, selecting an object in the runtime hierarchy should display that object's properties in the runtime inspector.
     
  15. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    hi, thanks for your reply!
    I did so, but it´s still not showing any data in the runtime inspector - any idea?
     

    Attached Files:

  16. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Does clicking an object in the runtime hierarchy highlight that object in the runtime hierarchy? If so, are there any error messages that may possibly prevent runtime inspector from functioning? Does an EventSystem object exist in your scene?
     
  17. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    hi, no clicking inside the runtime hierarchy doesn´t highlight that object in runtime hierarchy. I have no error messages. Yes there is an even system - plz take a look at the attached screenshot
     

    Attached Files:

  18. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Hmm, maybe a UI object (that may be transparent) is obscuring the runtime hierarchy and stealing those clicks? Otherwise, please try putting the runtime hierarchy and the runtime inspector onto a fresh new canvas in a new scene, connect each other and see if it still doesn't work.
     
  19. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    I did that with both - a clean canvas (no other UI objects) and a new scene as well - still the same... plz check the screenshot... any idea what else coud cause this?
     

    Attached Files:

    • RI.JPG
      RI.JPG
      File size:
      118.5 KB
      Views:
      365
  20. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Everything seems fine. The 'Cube' object is highlighted in the screenshot, so it shouldn't be a click issue. If you check RuntimeInspector's ScrollView, are UI objects getting added to it when you click on an object in the runtime hierarchy? Maybe the inspector is updating properly but we do not see it do so in the Game View due to an unknown bug?

    P.S. I can verify that the plugin works fine on 2018.1.3f1 at least.
     
  21. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    hey just found what the issue was... the runtime inspector was connected to the runtime hierarchy but the runtime hierarchy wasn´t connected to the inspecter.. now it works...but actually I would need the possibility to inspect objects which are placed at runtime (wihthout the runtime hierarchy in my scene)... looks like your asset can´t do that or am I missing something?
     
  22. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    You can call the Inspect function of the RuntimeInspector to inspect a custom object, you don't necessarily need runtime hierarchy for the inspector to work.
     
  23. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    this would be awesome! could you please show me an example how to achieve that?
     
  24. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Add a
    public RuntimeInspectorNamespace.RuntimeInspector inspector;
    variable to your script and call
    inspector.Inspect(OBJECT_TO_INSPECT);
    to inspect an object's properties. Don't forget to assign the runtime inspector to the inspector variable.
     
  25. HoplightUnity

    HoplightUnity

    Joined:
    Aug 18, 2015
    Posts:
    2
    This is fantastic. I have implemented this with my run time editor. Works perfectly:). Just a quick question though. Is there a way to drag the transformation values when you place your mouse over, like you can do in the inspector?
     
  26. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    It is currently not possible. I may add that logic in an upcoming update, though.
     
  27. HoplightUnity

    HoplightUnity

    Joined:
    Aug 18, 2015
    Posts:
    2
    Oh ok. Thank you so much, It will be awesome to see this in an update:). Keep up the good work, you have a very great tool.
     
  28. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    @HoplightUnity I decided not to add that feature to the plugin because this way, drag events are commonly intercepted by the input fields rather than the scroll view and that makes scrolling the inspector harder on especially the mobile platforms. But you can add that feature to the plugin on your own by following this process:

    Create InputFieldDragListener.cs:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.EventSystems;
    3. using UnityEngine.UI;
    4.  
    5. public class InputFieldDragListener : MonoBehaviour, IBeginDragHandler, IDragHandler
    6. {
    7.     [SerializeField]
    8.     private InputField inputField;
    9.     private float initialValue;
    10.  
    11.     private void Start()
    12.     {
    13.         if( inputField == null || ( inputField.contentType != InputField.ContentType.DecimalNumber && inputField.contentType != InputField.ContentType.IntegerNumber ) )
    14.         {
    15.             Debug.LogError( "Can't use InputFieldDragListener here!" );
    16.             Destroy( this );
    17.         }
    18.     }
    19.  
    20.     public void OnBeginDrag( PointerEventData eventData )
    21.     {
    22.         initialValue = float.Parse( inputField.text );
    23.         inputField.Select();
    24.     }
    25.  
    26.     public void OnDrag( PointerEventData eventData )
    27.     {
    28.         Vector2 delta = eventData.position - eventData.pressPosition;
    29.         float finalValue = initialValue + delta.x + delta.y;
    30.         if( inputField.contentType == InputField.ContentType.DecimalNumber )
    31.             inputField.text = finalValue.ToString();
    32.         else
    33.             inputField.text = ( (int) finalValue ).ToString();
    34.     }
    35. }
    To add drag support to e.g. DecimalField, select the VariableName child object of it, enable "Raycast Target", add InputFieldDragListener as component and assign DecimalField's InputField child object to the InputFieldDragListener's "Input Field" variable. You can follow the same steps for other prefabs, as well.
     
  29. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    hi there,
    I would like to click on different runtime instantiated prefabs and display transform data for each in the inspector without using the runtime hierarchy - is this somehow possible?
     
  30. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Of course! You should use the RuntimeInspector's Inspect function and pass the clicked GameObject or Transform as parameter to it.
     
  31. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    hey thanks for your fast reply! These are awesome news :) unfortunately I am not quite sure how to achieve that. Would you mind sharing a code example to achieve that?
     
  32. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Code (CSharp):
    1. public RuntimeInspector inspector;
    2.  
    3. public void InspectObject( GameObject clickedObject )
    4. {
    5.     inspector.Inspect( clickedObject.transform );
    6. }
     
  33. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91

    hey thank you very much for the code snippet!

    I put this onto an empty object inside my scene but when I click on any of my prefabs the inspector is just gray (as soon as I choose the object from within the runtime hierarchy it´s showing the correct data)

    am I missing something or where would I need to put the code?
     
  34. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Are you calling the InspectObject function and pass the clicked object as parameter to it?
     
  35. xkinginthecastlecastlex

    xkinginthecastlecastlex

    Joined:
    Nov 7, 2018
    Posts:
    91
    hi there,
    thank you very much for your fast reply!

    I tried to integrate it with the asset which I am using to instantiate prefabs at rutime but currently it´s not working.
    If you like you can take a look here: https://rld.readthedocs.io/en/latest/ObjectSelectionEvents/ and https://rld.readthedocs.io/en/latest/ObjectSelectDeselectReasons/

    so it should be something like this to capture the selection changed event:

    RTObjectSelection.Get.Changed += OnSelectionChanged;

    ....

    private void OnSelectionChanged(ObjectSelectionChangedEventArgs args)
    {
    if (args.SelectReason == ObjectSelectReason.Click ||
    args.SelectReason == ObjectSelectReason.ClickAppend)
    {
    var objectsWhichWereSelected = args.ObjectsWhichWereSelected;
    InspectObject(objectsWhichWereSelected[0]);
    }
    }

    and I used so far:

    public RuntimeInspectorNamespace.RuntimeInspector inspector;

    public void InspectObject( GameObject clickedObject )
    {
    inspector.Inspect( clickedObject.transform );
    }


    It looks like I haven´t done it properly..
    do you maybe have an idea for a solution?
     
  36. qufangliu

    qufangliu

    Joined:
    Apr 23, 2018
    Posts:
    3
    How to inspect a static class? I have some static class to save config datas, and i want to edit it in game.
     
  37. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    @xkinginthecastlecastlex Did you assign the RuntimeInspector to the "Inspector" field of this script from Unity's Inspector? Are there any error messages in the console? Can you put a Debug.Log inside the InspectObject function to see if it is getting called? Does
    clickedObject != null
    return true?

    @qufangliu It is not possible, but there is a workaround for this:

    Code (CSharp):
    1. // Example static class
    2. public static class TestStatic
    3. {
    4.     public static int intVar;
    5.     public static string strVar;
    6. }
    7.  
    8. // Example helper class
    9. public class TestStaticComms
    10. {
    11.     public int IntVar
    12.     {
    13.         get { return TestStatic.intVar; }
    14.         set { TestStatic.intVar = value; }
    15.     }
    16.     public string StrVar
    17.     {
    18.         get { return TestStatic.strVar; }
    19.         set { TestStatic.strVar = value; }
    20.     }
    21. }
    Simply calling
    runtimeInspectorObject.Inspect( new TestStaticComms() );
    should do the trick.
     
  38. qufangliu

    qufangliu

    Joined:
    Apr 23, 2018
    Posts:
    3
    Thanks!
    I have modified ObjectField.cs and InspectorField.cs, and added a panel to show the list of my classes, now, it support to edit static class.
     
    yasirkula likes this.
  39. thefallengamesstudio

    thefallengamesstudio

    Joined:
    Mar 7, 2016
    Posts:
    470
    Hey. I'm using your asset from the very beginning and it was of great help!

    I'm considering using your asset in actual production, but I need to know if I can rely on it long-term.
    So I need to know the following:
    1. can I use the inspector as a standalone tool to display/edit instances of plain classes?
    2. do you use your own hierarchy-traversal system or somehow managed to re-use Unity's? This is important because I need to support List<BaseClass> = {list of arbitrary BaseClass-derived instances}. I'm using YAML for (de)serialization, so I only care about simply displaying/editing objects at runtime using your inspector. Our data graphs became very complex and writing specific UI for each class is not feasible.
    3. It'd be really useful, if not already implemented, if you had different self-contained components drawer classes that are intended only for specific "scalar" types (final nodes in a hierarchy), like one for bool, one for string, one for list/array of primitives etc. This, and a way of allowing some properties to be displayed/modified manually. I need this for a list of "Condition"s that can be of different types and that need multiple buttons depending on their type.

    Even if not all of these are implemented, it'd help if you can let me know if this could be done by me alone just looking through the code. I thought asking here is the best first thing to do, before starting to modify your code on my own.

    Thanks for this nice asset!
    Lucian
     
  40. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    1. You can inspect any class instance using the
    RuntimeInspector.Inspect
    function.
    2. I think you are asking these; so yes, I try to simulate Unity's default behaviour with my own code. They are not identical, though; as simply adding
    [System.Serializable]
    attribute to BaseClass will make it possible to expose List<BaseClass> in the RuntimeInspector.
    3. Maybe I misunderstand you but there are already different drawers for different types and it is possible to implement your own drawer.

    Let me know if you have any other questions!
     
    thefallengamesstudio likes this.
  41. rtjia

    rtjia

    Joined:
    Jun 6, 2017
    Posts:
    5
    Hi
    I want add custom type (story) for new Layout, yes ,i make and add StoryStringField prefab to InternalSettings and GlobalVariablesInspector. but in inspector , i cant see this var.
    Why?

    public class StoryString
    {
    public string text;
    public StoryString(string story)
    {
    text = story;
    }
    }
    public class StoryStringField : InspectorField
    {
    ....
    }
     
  42. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Try adding
    [System.Serializable]
    attribute to StoryString class.
     
  43. thefallengamesstudio

    thefallengamesstudio

    Joined:
    Mar 7, 2016
    Posts:
    470
    Thanks! This is really useful for us!

    Do you think that changing the order of the properties returned by reflection can break something along the way?
    I want to re-order the propertyinfos returned by reflection before passing them to the inspector. Does the inspector make the assumption that members of derived types come first? I'd like base members to come first
     
  44. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    I don't remember such an assumption. Feel free to modify their order.
     
    thefallengamesstudio likes this.
  45. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,833
    Is there a way to limit the number of parameters each gameObject shows. For example in the transform I would like it only show position, rotation and scale and layer
     
  46. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    To determine which variables of a Type should be exposed or hidden, see the Hidden Variables and the Exposed variables properties of the RuntimeInspector Settings asset: https://github.com/yasirkula/UnityRuntimeInspector/#d1-inspector

    If you'd like a GameObject to only show position, rotation, scale and layer, you should edit GameObjectField.cs.
     
  47. CabbageCrow

    CabbageCrow

    Joined:
    May 28, 2017
    Posts:
    4
    Hi, I've found your awesome asset and tested it in a project.
    Yet the thing is, I wanted to use it as a modding aid for an existing game. I think you can imagine how useful it would be there to explore the objects, since there isn't an inspector in a built game anymore.

    The question is, how could I get it into there? I use Harmony to patch methods.
    https://github.com/pardeike/Harmony/wiki
    I tried AssetBundles, but these cannot contain Scripts ...

    There are ways to load scripts which weren't compiled with the game, but it's quite a workaround. Furthermore I doubt if all the references of the scripts inside the Prefabs can be retained.
    https://answers.unity.com/questions/1214408/how-to-import-script-at-run-time-using-assetbundle.html

    Any ideas how I could go about it? Or how the RuntimeInspector would have to be restructured to load it more easily by a injected mod?
    I would like to avoid having to rebuild all the prefabs with pure code ...
     
  48. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Adding modding support to your game is something I have no experience with. In the past, I also researched for ways to add scripts to asset bundles and I couldn't find anything practical either. So for scripts, the most promising solution seems to be Harmony.

    Regardless, RuntimeInspector should always be able to inspect any object you want, be it a component attached via Inspector or a component/object created via reflection.
     
  49. logixworx

    logixworx

    Joined:
    Jun 29, 2017
    Posts:
    76
    If I wanted to use another UI asset to display the Inspector and Hierarchy panel, what would need to be done?
     
  50. yasirkula

    yasirkula

    Joined:
    Aug 1, 2011
    Posts:
    1,589
    Something like NGUI? I believe it'd be a tedious task because both the prefabs and the code heavily relies on Unity's UI system.
     
unityunity