使用LeanCloud-Unity-Realtime-SDK-20180117.4
.Net 3.5版本 (特殊原因只能用这个)
[AVIMMessageClassName("_AVIMScrawlMessage")]
public class AVIMScrawlMessage : AVIMTypedMessage
{
[AVIMMessageFieldName("_lctype")]
public int LCType { get; set; }
[AVIMMessageFieldName("photoUrl")]
public string PhotoUrl { get; set; }
public AVIMScrawlMessage() {}
public AVIMScrawlMessage(string url) {
PhotoUrl = url;
LCType = 2;
}
}
初始化
_avRealtime = new AVRealtime(avrtId, avrtKey);
_avRealtime.RegisterMessageType<AVIMScrawlMessage>();
错误提示
NullReferenceException: Object reference not set to an instance of an object
LeanCloud.Realtime.Internal.FreeStyleMessageClassingController.EncodeProperties (IAVIMMessage subclass)
LeanCloud.Realtime.AVIMTypedMessage.Serialize ()