A MindBreaking MonoBehaviour Issue!. (Unity3D v5.1.0f Pro: unityserializer-ng VS Photon Unity Networking)
EDIT: Maby usefull Question Binded to this problem, Shall i use Unity3D v5.3.x instead of v5.1.x, as in: may it be fixed in that newer version or..?
I am working my but off to Make a Sick game, Loads of people do that, but most of them wil walk into those stupid Problems when making them.
My Problem is about a MonoBehaviour in Combination of Photon Behaviour, This code is by the Photon Config System (PUN > Setup) Edited into a unityserializer-ng Script for Saving/Loading Advanced Game files etc.. but It's that line where the problems start's with, and from there Compiling error's do not display but only the 'Ex' MonoBehaviour get's show in the Console of Unity, It doesnt even show me where the problems actually is at as in Unity and Mono!.
Ive tryed like every possible solution and/or fix to make the script operational and functional again, Was not such of a Success..
After a while i started a Topic on another Development website as results again where no success in any way, Answers, Possible Fixe's, And even a few Modular Dev's failed in helping me. So i thought, i just Directly ask it to the Unity Forum Staff's itself!..
I hope one of you can help me out?..
Well, it has to to with this line as hardly mentioned above:
public class InheritableRPC : Photon.MonoBehaviour
And the Full Script of the Behaviour aswel:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using System.Reflection;
[AddComponentMenu("System/Inheritable RPC Handler")]
public class InheritableRPC : Photon.MonoBehaviour
{
public class CachedRoutine
{
public MethodInfo routine;
public MonoBehaviour behaviour;
}
private Dictionary<string, List<CachedRoutine>> cache = new Dictionary<string, List<CachedRoutine>>();
[RPC]
void PerformRPCCall(string routineName, string parameters)
{
var b = new BinaryFormatter();
using(var s = new MemoryStream(Convert.FromBase64String(parameters)))
{
var p = (object[])b.Deserialize(s);
if(!cache.ContainsKey(routineName))
{
cache[routineName] = GetComponents<Photon.MonoBehaviour>()
.Select(m=> new CachedRoutine { routine = m.GetType().GetMethod(routineName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance), behaviour = m })
.Where(r=>r.routine != null && r.routine.IsDefined(typeof(RPC), true))
.ToList();
}
foreach(var m in cache[routineName])
{
m.routine.Invoke(m.behaviour, p);
}
}
}
}
public static class InheritableRPCExtensions
{
public class StoredPlayer
{
public string ipAddress, guid;
public int port;
}
public static void RPCEx(this PhotonView view, string routineName, PhotonTargets mode, params object[] parameters)
{
using(var m = new MemoryStream())
{
var b = new BinaryFormatter();
b.Serialize(m, parameters);
m.Flush();
var s = Convert.ToBase64String(m.GetBuffer());
view.RPC("PerformRPCCall", mode, routineName, s);
}
}
public static void RPCEx(this PhotonView view, string routineName, PhotonPlayer player, params object[] parameters)
{
using(var m = new MemoryStream())
{
var b = new BinaryFormatter();
b.Serialize(m, parameters);
m.Flush();
var s = Convert.ToBase64String(m.GetBuffer());
view.RPC("PerformRPCCall", player, routineName, s);
}
}
}
Here is an Zipped file of the Plugins DB from: unityserializer-ng Asset, That got converted by Photon:
And if you need a full Copy of my project, PM me, i wil Try to send the Project in any way possible (may considering doing that into a Live Interactible OnlineDrive Future).
Gr.Djni Wlk, MultiFunctional Developer/Producer.
PS: If i posted this in the wrong Section (Moderators/META/Etc), Tell me instead of directly removing it, I would like to know if it's posted correctly or not, This wil help also in Future'd Posts and Questions etc i may possible need. Just Notify me first atleast, Thx.
Your answer
Follow this Question
Related Questions
Network lobby manager tutorial +PUN? 0 Answers
Photon Network, synchronize a int over the network. 1 Answer
Rejoin in photon network? 2 Answers