x


RPC Failed because the script couldn't be loaded.

Hello, I am currently working on making buttons ans switches networked so that they perform what is needed on all client.

I am running into the error "RPC call failed because the script couldn't be loaded. The function was 'ToggleSwitch'." on a few of my scripts. Most work fine though.

Here is the code:

function OnMouseDown () 
{
    //ToggleSwitch();
    networkView.RPC("ToggleSwitch", RPCMode.All);
}

@RPC
function ToggleSwitch()
{
    switch (lcu_static_variables.back_text)
    {
          .....
    }
}

the exact same setup works in other scripts... Any ideas what is wrong?

more ▼

asked Sep 22 '10 at 04:52 PM

Kelhedros gravatar image

Kelhedros
6 4 4 8

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

This happens when you have a "Missing Monobehaviour" on the same gameobject (a missing script).

more ▼

answered Oct 03 '10 at 11:47 AM

Leepo 1 gravatar image

Leepo 1
283 8 10 21

Thanks Leepo, I dont know why I didnt spot that missing behaviour sooner. Guess its just the size of the scene.

Anyway, thanks . . worked a treat for me.

Feb 20 '12 at 12:28 PM Fehr

@Fehr: This question (+ Answer) is 1.5 years old and you post this comment, two times, as Answer... If you think your comment is that important, please use the "add new comment"-button.

-> converted

Feb 20 '12 at 12:33 PM Bunny83

Hey Bunny83.

I tried that but something wierd was happening, and my comment wouldn't appear. For this reason I posted it as a answer instead, and even then it seemed not to appear. It seems it did, twice haha.

I didnt feel it was paricularly important, just wanted to say thanks. Leepo's comment helped. Thanks for fixing that up, I wont let it happen again.

Feb 20 '12 at 11:38 PM Fehr

thank you, Leepo.

Nov 14 '12 at 02:51 AM yadoa
(comments are locked)
10|3000 characters needed characters left

This can still happen if you have an script that is attached (not missing) but empty. For instance, a script, the entirity of which is wrapped in:

#IF UNITY_IPHONE
//code here
#endif

Would produce this error when on a platform other than iOS. Its an edge case, but perhaps this kind of thing is what's causing this issue for you.

more ▼

answered Jun 13 '12 at 11:51 AM

Fehr gravatar image

Fehr
76 2

(comments are locked)
10|3000 characters needed characters left

I've received the same runtime error message and I think that my GameObject hasn't got any missing script attatched to...I've revised a lot of times and well...I don't know what can be...

Any idea?

more ▼

answered Jun 13 '12 at 10:53 AM

jorgon gravatar image

jorgon
77 26 34 35

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x697
x236

asked: Sep 22 '10 at 04:52 PM

Seen: 1913 times

Last Updated: Nov 14 '12 at 02:51 AM