Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How can gameobjects be compared in different projects?

Discussion in 'Editor & General Support' started by kjhuebner, May 29, 2023.

  1. kjhuebner

    kjhuebner

    Joined:
    Oct 2, 2018
    Posts:
    16
    Within Unity editor, how can a first gameobject in a project be compared with a second gameobject in a different project?
    Both gameobjects are comprised of multiple child gameobjects.

    I want to know if any descendent gameobjects, components, and attributes have changed, and how have they changed.

    Thanks,Ken
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,519
    Make an editor script that digs into the hierarchy and writes out what it finds to a text file.

    For any particular component you would just use reflection to iterate all the public fields and print those too.

    We did one of these years ago when we made a Unity Editor Script to trans-compile an arbitrary UnityEngine.UI scene into a bunch of Javascript code to create the exact same layout when using a pure Javascript engine (Phasor.io).

    It's just GetComponent<T>() and transform.childCount and a little sprinkle of recursion.

    It was just a few hours of chasing down StackOverflow "how to" articles, really.

    To understand recursion you must first understand recursion.

    EDIT: oh obviously, once you emit the text file from each project just run them through
    diff