Search Unity

Pointers as param to and return type from plug-in

Discussion in 'Scripting' started by fhmiv, Mar 26, 2007.

  1. fhmiv

    fhmiv

    Joined:
    Jan 31, 2007
    Posts:
    38
    I'd like to return a pointer to some data I allocated on the stack back from a plug-in, and I'd like to pass that same pointer back in to another function in the plug-in. How do I do it with C#?
    Thanks,
    Frank
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    You can pass reference parameters by adding the ref or the out keyword in front of the parameter name in the C# function signature:

    Code (csharp):
    1. int PassingAReference(ref Vector3 v)
     
  3. fhmiv

    fhmiv

    Joined:
    Jan 31, 2007
    Posts:
    38
    Thanks, that does the trick nicely.
    -Frank