- Home /
Creating a software for drawing diagrams
Hello there people of Unity! :)
I want to make a software like yEd Graph Editor (although much simpler) with Unity3D so I want to ask you two questions regarding that:
1.How efficient and smart would it be to choose Unity for such a software? (personally I chose Unity because I wanted to be able to have big diagrams with thousands of nodes and still get a decent performance, and also because I wanted to learn unity at the same time - two birds with one shot)
2.Could you please give me just an initial idea or push in a right direction regarding how to start making such a software in Unity3D? I cannot make my mind about whether I should use UI elements for representing the diagram nodes, or should I simply use sprites with text labels over them...or perhaps 3D planes? What approach would be better performance wise and feature wise?
Feel free to write anything you think may be important for me, I would really appreciate any help and any additional tip or advice!!
Answer by tanoshimi · Aug 11, 2015 at 07:04 AM
IMO, using Unity for that sounds like a pretty terrible idea. Unity is a game engine; it has features optimised for making games such as AI pathfinding, 3D audio, lightmapping, physics, PBR, joystick input, network matchmaking...
...your application won't make use of any of those features, but it will still be bloated by having to include the necessary libraries for them. And you won't learn much about using Unity either because you won't touch on any of those features. Unity probably could perform the task you're asking about, but it's certainly not optimised to get "decent performance" with thousands of static UI elements.
If you want to make a windows application, use WPF/Windows Forms. If you want to make a game, use Unity.
Thanks for your input a lot! I do understand that I might get a lot of unnecessary features "shipped" with unity, but that's not a problem to me as long as performance stays the same.
As for Windows forms/WPF, from what I understand it does not possess the ability to efficiently draw thousands of rectangles which could be dragged. Last time I tried to do this with Windows Forms I got lagging at hundred nodes let alone thousands of nodes. Am I missing something?
Remember that Unity cross-compiles to dozens of platforms - Win/OSX/Linux/PS3/4/Xbox/Vita/Android/iOS/../../.. - so it can't possibly have as effective performance on any of those platforms as a native app specifically targetted to just one platform.
If you want best performance on Windows, learn C++. But that means your question is no longer related to Unity development at all and doesn't belong on these forums.
Yes, that's a good point, but still...I'm thinking if Unity is able to pull off great performance with a very complex high end video game, it should be able to draw thousands of simple nodes (Basically rectangles, circles and triangles with labels on them) without many glitches. Am I wrong?
So if you believe that the main obstacle would be performance, than I wold definitely listen to your advice, because that's an important part of it for me.
Answer by Hellium · Aug 11, 2015 at 07:14 AM
Clearly, I would not advise Unity at all for this kind of software :
Unity has good performances for what it's intended to do : create games. Otherwise, many functionnalities you won't use will still be in action (rendering, physics, ...)
Unity doesn't offer nice 2D primitives easily. You will have to deal with OpenGL most of the time (which is quite painful)
Other tools exist which are more "powerfull" and will simplify your development to do what you want. Though, some may not be multiplatform (Winforms : C# / Visual Basci ; Qt : C++. Last but not least : web languages : JavaScript especially.
Thank you for your reply! Like I wrote in a comment to tanshimi, I didn't have a great experience with windows forms when it comes to performance. I tried to make this software in Windows Forms but already at less than hundred nodes I got poor performance when dragging nodes or panning/zoo$$anonymous$$g. From what I know (and I still don't know much) Windows forms and Javascript options would be way too slow for thousands nodes on the canvas, am I correct?
Answer by JoshuaStrunk · Aug 11, 2015 at 06:18 PM
I am going to go against the grain here and say Unity could be a decent choice. It really depends on how your project evolves over time. People use Unity all the time to make things other than games. Unity is also indeed optimized to handle drawing thousands of rectangles. It also could prove useful later on to have access to 2D physics for collisions or a location based audio system. Your final program will be little larger than using something that only handles UI, but as for runtime performance I personally do not believe you will be paying(that much) for all the other features Unity has unless you use them. So if you really want to try it out no harm there. You already mentioned wanting to learn Unity so even if you decide to migrate to another platform in the future it is not really any time wasted.
If I were to make an application like you are describing I would go with Unity's built in UI system. It is easy to use both in and out of scripts and has tons of features packed in that can help you get your project going quickly.
Thank you for your reply Joshua! I am glad to hear that, you got my hopes up! :) Now after these three replies I think I'm going to be a bit indecisive! :D
As for my program being larger and having more features than I need, I don't $$anonymous$$d at all really. I intended my program to have some parsing/reading features that would make program go through the whole tree of nodes that a user has drawn, look for the types of connections, types of nodes, values inside the nodes, values on the connections, make some calculations and pop up some warnings based on all of that etc... It does seem complex, but I too don't see what exactly is a real downside to doing this in Unity.
Also with Unity I get the cross-platform thing. I will also get to make everything myself from scratch, so I can have a full control and I'd be very familiar with my code, which I always appreciate since I am terrible at adopting someone else's code/library/framework
Answer by DavidLe360 · Oct 17, 2020 at 12:06 AM
Hi @Vegeta_DTX, I am in a kind of same situation as you: use Unity to create an diagram, advance note taking, with Unity. After some research, i decide to give a go with Unity.
TextMesh Pro is a good tool for that purpose.
... Would discuses more if you want.
Btw, there a app call https://www.diagrams.net/, is open source. It is pretty interesting. I downloaded the source code, have tried to make some change in the code, just for testing if I installed everything correctly, but not 100% successful ...
That app, make me say to myself "Am I reinventing the wheel" !?, "Should I learn the code of that app, then modify it to have features I want", etc.
For now, I decide to keep going with what I have done with Unity, knowing that Unity can do what I want (vs the diagrams.net app which I am not sure if is possible).
Your answer
Follow this Question
Related Questions
How can I detect changes to GraphView, Nodes and Edges? 1 Answer
Chart libarry like highcharts in Unity 1 Answer
How to make a node based editor in Unity 3 Answers
Is there an event/boolean for when the application is paused or resumed in the editor? 0 Answers
loading 3d models in unity editor and in deployed app 1 Answer