"You are not allowed to call this function when declaring a variable." Error Message
Options
zchggf
✭
Hey guys
I recently got a random problem with photon
it says "You are not allowed to call this function when declaring a variable" and it's referring to the "PhotonNetwork.cs" script on line 2987.
I literally haven't done anything to that script it just broke up by it self.
not sure why but here is what I already tried:
Re-importing "PhotonNetwork.cs" script.
Re-importing the whole photon asset.
Re-importing all (The whole Project).
Re-configuring "PhotonServerSettings".
Creating a new script with the same name and the same code.
Re-installing Unity.
But unfortunately non of these seems to work.
BTW here is the line that causes that problem:
UnityEngine.Object.DestroyImmediate(serverSettingTest);
any idea would be appreciated.
UPDATE:
I did something and now the error switched to line 1082 where it says:
PhotonHandler[] photonHandlers = GameObject.FindObjectsOfType(typeof(PhotonHandler)) as PhotonHandler[];
but the same problem still exists.
I recently got a random problem with photon
it says "You are not allowed to call this function when declaring a variable" and it's referring to the "PhotonNetwork.cs" script on line 2987.
I literally haven't done anything to that script it just broke up by it self.
not sure why but here is what I already tried:
Re-importing "PhotonNetwork.cs" script.
Re-importing the whole photon asset.
Re-importing all (The whole Project).
Re-configuring "PhotonServerSettings".
Creating a new script with the same name and the same code.
Re-installing Unity.
But unfortunately non of these seems to work.
BTW here is the line that causes that problem:
UnityEngine.Object.DestroyImmediate(serverSettingTest);
any idea would be appreciated.
UPDATE:
I did something and now the error switched to line 1082 where it says:
PhotonHandler[] photonHandlers = GameObject.FindObjectsOfType(typeof(PhotonHandler)) as PhotonHandler[];
but the same problem still exists.
0
Answers
-
Hi,
Did you try suggestions from Unity forum?
http://answers.unity3d.com/questions/22966/error-message-you-are-not-allowed-to-call-this-fun.html0