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

where should i start?

Discussion in 'UI Toolkit' started by m4l4, Jan 15, 2021.

  1. m4l4

    m4l4

    Joined:
    Jul 28, 2020
    Posts:
    81
    Hi everyone, sorry for the noobish question, but i feel kinda lost.

    I'm working on a reinforcement learning simulation, and i'm looking for ways to make a 2d representation of the neural net (basically just colored circles connected with colored lines).

    The project is 3d, i've never worked with UI, nor with 2d elements. The idea is to click on the agent, and to have his brain displayed on a 2d panel in the upper right corner of the screen.

    I've followed some tutorials about ui, but they all seems overly complicated for such a simple result.

    any suggestion on where should i start, and what should i study to achieve my goal?
     
  2. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    1,184
    When it comes to 2D graphics in Unity, you have at least three options:
    1. Sprites position in 3D
    2. The component/GameObject-based UI system (originated in Unity 4.6)
    3. UI Toolkit (this forum)
    When positioning sprites in 3D you would have to implement layouting yourself to fit things into the camera's view, so I wouldn't recommend it. UI Toolkit is relatively new and the available documentation is not as detailed as for the older UI system. For the time being and your use-case, I would recommend looking into the regular UI system. It's very easy to throw together panels and things with GameObjects in the scene. You can also use a RenderTexture and RawImage to display the viewport contents of any camera in the scene, for example without any scripting required. Not sure what you're looking for exactly, but it's also possible to position graphics drawn by the Image component via scripting and so on. Would need more information to give more advice. ;)
     
    m4l4 likes this.
  3. m4l4

    m4l4

    Joined:
    Jul 28, 2020
    Posts:
    81
    thanks for you reply, i'll try to be more specific.
    I have a bunch of "3D bacteria" running around my screen, each of them has a neural net that process information from the environment, and outputs an action.

    here's an image from the NEAT algorithm paper, to let you better understand how a neural net is represented.
    https://imgur.com/a/WLqqK9J

    As you can see, i have a list of nodes (node genes) and a list of connections.
    Nodes are the "circles", they have their unique id, and a type. Sensors (inputs) go at the bottom, output are the uppermost neurons, and hidden neurons go in the middle.

    Connections describe how nodes are linked together (in - out), and are depicted as lines.

    My goal, is to click on a bacteria, and have his neural net topology depicted on a 2d panel onto the screen.

    I can easily access data in the genome, but when it comes to position circles and lines on the panel i feel lost, and i find it way more convolute then the rest of the project.

    That's why i thought i was doing something wrong and started asking questions :D
    Hope that explain my situation a little bit better