1
TNet 3 Support / Exception has been thrown by the target of an invocation.
« on: August 11, 2013, 03:09:36 PM »
Hi I know this is an open ended question but I bump into this error a fair bit. What exactly does it mean?
For example today I have this error in a script that makes the chat window open/close on all clients by any client who wants to start it:
Exception has been thrown by the target of an invocation.
chatWindowToggle.ChatMode (System.Boolean)
Below is both scripts. They are both on the same gameobject....
Here is the script @RFC:
What am I doing wrong?
For example today I have this error in a script that makes the chat window open/close on all clients by any client who wants to start it:
Exception has been thrown by the target of an invocation.
chatWindowToggle.ChatMode (System.Boolean)
Below is both scripts. They are both on the same gameobject....
Here is the script @RFC:
- #pragma strict
- var chatScript : ExampleChat;
- var playerMoveScript : playerPhysixMoveAim;
- var playerShootScript : playerShootV2;
- var chatModeEnabled : boolean;
- var tno : TNObject;
- //-------------------------------------------------------------------------------------------------------
- //-------------------------------------------------------------------------------------------------------
- function Awake (){
- if(!TNManager.isThisMyObject) {
- Destroy (this);
- }
- }
- //-------------------------------------------------------------------------------------------------------
- //-------------------------------------------------------------------------------------------------------
- function Start () {
- chatScript = GameObject.Find("--Level--/GUI/Chat").GetComponent(ExampleChat);
- playerMoveScript = GetComponent(playerPhysixMoveAim);
- playerShootScript = GetComponent(playerShootV2);
- chatScript.enabled = false;
- tno = GetComponent(TNObject);
- }
- //-------------------------------------------------------------------------------------------------------
- //-------------------------------------------------------------------------------------------------------
- function Update () {
- if(Input.GetKeyDown(KeyCode.Escape)){
- chatScript.enabled = !chatScript.enabled;
- playerMoveScript.enabled = !playerMoveScript.enabled;
- playerShootScript.enabled = !playerShootScript.enabled;
- chatModeEnabled = !chatModeEnabled;
- tno.Send("ChatMode", Target.Others, chatModeEnabled);
- }
- }
- //-------------------------------------------------------------------------------------------------------
- //-------------------------------------------------------------------------------------------------------
- @RFC
- function ChatMode (chatModeActive : boolean){
- print("TNO RECIEVED" + chatModeActive);
- if(chatModeActive == true){
- chatScript.enabled = true;
- playerMoveScript.enabled = false;
- playerShootScript.enabled = false;
- }
- if(chatModeActive == false){
- chatScript.enabled = false;
- playerMoveScript.enabled = true;
- playerShootScript.enabled = true;
- }
- }
What am I doing wrong?