1

I'd like to use c++ code in Unity3d. Normally, it is ok, i can do it by importing dll. What i'm trying to learn is whether using c++ method parameters as pass by reference is possible or not?

What i'm trying to do is getting size of uchar* array returned by c++ code.

Dilara Albayrak
  • 314
  • 1
  • 3
  • 23

1 Answers1

2

What i'm trying to learn is whether using C++ method parameters as pass by reference is possible or not?

Yes, it is possible. Use int* on the C++ side and ref int on the C# side. You should be able to write to that parameter from C++ and it will update on the C# side.

See this answer from my other post for a complete example.

What i'm trying to do is getting size of uchar* array returned by c++ code.

You can with the example above. If you care about performance, do not return array from C++. Create the array in C# then pass it to C++ and modify it there. See the linked answer for information.

Programmer
  • 121,791
  • 22
  • 236
  • 328