C++ tools for unity

Hi!

Due to a variety of reasons i’d like to make a C++ plugin which would have access to engine. I mean - getting objects locations, parameters, changing them and so on…

Based on articles i found that creating managed plugins is totally possible (some sources say it requires unity pro - which is not a problem).
But no source describes any engine C++ sdk… Is there such thing? Is it possible to operate scene objects from raw C++ and if it is (which is quite logical, taking into account unity’s core is C++) - then where do i find libraries/headers for that?

Thank you in advance…

Hi.
You can not call Unity features from native C++. You can call C++ code from Unity through a native dll but not the other way around. Unity - Manual: Plug-ins
It may be possible to use a Managed C++ dll although its not pretty, difficult to debug and likely wont work for your use case as it does not support mixed assemblies. Considerations/Gotcha's when Creating a C++ CLR Plugin in VS2008 - Questions & Answers - Unity Discussions
Can you not pass what you need from the C++ side and do the Unity work in .Net?

There is no C++ sdk.
There is minimal interface for native plugins, but it is incredibly limited, so you won’t be doing much of useful stuff with it.
So you cannot use C++ with the engine in even remotely productive way.

You should either adapt to C# (I don’t like that language either), or use some other, C++ based engine.

That means i’ll have to support my thing on both CPP and C#… :confused:

Hope someday there will be such sdk :slight_smile:

And thank you for your answers!

it is a pretty huge limitation for performance. Maybe with all of Unreal engines competing and making more desirable moves to get developers back, maybe Unity will integrate something. When working with large mesh data… you have to have C++ for performance reasons. C# is okay, but he is nothing like his father.

They did
https://docs.unity3d.com/Manual/IL2CPP.html
Most platforms now support IL2CPP, which indirectly converts your C# to C++ before compiling to binary. So there are no more performance issues associated with IL JIT compiling (which is typically what people are actually referring to when they talk about relatively poor C# performance - it isn’t the language that performs slowly, it is the fact it is typically compiled to IL instead of machine code). Where are you seeing your performance problems now? As this feature was limited to only a small number of platforms when this thread was created.

According to one of the developers, the issue is less severe in unity 2017 vs 2019 for some reason… but… I am working with point cloud data which is typically a file that looks like this

100200300 (it means that there are this many lines of code following) (ASCII BASED - typical and very large)
123.456(float), 123.496(float), 290.23(float), 11 or 12 bit scalar value, R (char), G(char), B(char)
163.42(float), 125.754(float), 103.45(float),11 or 12 bit scalar value, R (char), G(char), B(char)

Binary Based:(a typical but fairly reasonably sized)
00000000101001001001001001001001010(not seperator, but imagine there is)010010100100100101 1001001001010010 10010101010010010 (ETC ETC, No new line endings because binary, its just a long structure file that requires knowing its organization).

** sometimes this float data needs to be written as double float data, and we both know this is bad for unity so have to do extra conversions/math/processing.
**Keep in mind this is a small file for my work. 5gb… meh. most of them are 12-25gb files that need processed.

So first of all there are 2 methods to visualize this data (which is very much similar to mesh data without the lines and faces and indexing… its just vertex3 data as float, float, float, (char/short), char, char, char)

  1. Converting it into a binary format
  2. Converting it into a mesh format (mesh filter)

There are 2 converters that come with this particular asset written in C# (I dont know if it is IL2CPP) as most of the C# code is available and runs as is I am assuming not,also assuming that you are referring to the program being compiled into C++ etc once ready for client.

I’ve written a basic C++ Program that performs this same task (similar, not exact because I have to do a lot of extra coding to finish it which I intend to but instead of adding it all to 1 file I created 5 files and parse it out which in theory would take longer), and it does the same task in 1/10th of the time (generally).

Eventually I will need to make a similar version to be run by my clients and most of the competition is running this in C++ or even C ( :open_mouth: ). Because these data files in ASCII are about 5gb, and 1.x gb in Binary… I need performance to process the massive amounts of data. Keep in mind that these again are small file sizes… which means that customers receiving it would be spending an extra 20 minutes waiting for a single file which could be done in 3 or 4 minutes.

I need a way to integrate it into Unity not only for development/testing… but once compiled I know that it will work and I can go back in make changes and updates and release from all in one place instead of having to create separate instances and files and protocols to do something that would be perfectly easy to do in Unity…

Not to mention… if you could C++ script… you would have a development platform/interface to develop GUIs for C++… that would be a game changer in and of itself. No more WXWIDGETS… (PLEASE).