Structure with string cannot be used as a RPC parameter.

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Structure with string cannot be used as a RPC parameter.

[Deleted User]
2022-01-05 21:14:59

Hi,

I tried to use a struct as a parameter for my RPC:

public struct TestStruct : INetworkStruct    
{    
    [Capacity(32)]    
    public string Text { get; set; }    
}    

And then:

[Rpc(RpcSources.All, RpcTargets.All)]    
public void RPC_Test1(TestStruct message, RpcInfo info = default)    

But I cannot compile it - with an errors:

Fusion.CodeGen.ILWeaverException: Failed to get word count of field System.String TestStruct::k__BackingField

and

(0,0): error ---> Fusion.CodeGen.ILWeaverException: Reference type System.String is not supported

Is using a string in a RPC struct supported? Or is it a bug?

Comments

ramonmelo
2022-01-17 12:46:40

Hi,

As described by the error, Strings are not yet supported in this scenario.

We will probably include support for more types as the development advance, always try to be at the latest SDK version to get all updates.

--

Ramon Melo

Photon Fusion Team

Back to top