x


GUI and spawning at runtime

I built my game with a player that was in the scene and had the GUI all working correctly with sound effects for the opening of windows and the closing of windows. There are a series of prefabs with GUI scripts attached to them so when you bump into them they display a GUI window.

I used the network example file from Unity's site to bring over the needed networking elements and allow users to play together. This requires that the player be removed from the scene and be spawned in at runtime. Now, when I bump into something that once open up a GUI, it does nothing... with the exception that it's still playing the sounds for opening and closing of the GUI. So something is happening but I can't tell what.

Does the GUI script that is attached to the game object need to reference a particular camera? If so, how do I do that?

Where did these GUI elements vanish to? Man, this is a really abstract question. I hope someone out there understands what I'm saying.

more ▼

asked Dec 23 '11 at 05:11 AM

Fletch gravatar image

Fletch
31 2 2 2

Okay, it seems it didn't want to post my answer. I've been looking for something similar, but a few things that helped my GUI read properly is adding " @RPC " before and functions you want the network to calculate, such as losing health. I've seen something about attaching a NetworkID to the GUI as well, but haven't looked into it. Send me a personal eMail and I'll keep in touch with anything I find. I'm sorry I can't give you a cold hard answer for it.

Apr 12 '12 at 08:29 AM 88bueno
(comments are locked)
10|3000 characters needed characters left

1 answer: sort oldest

Not an answer, not too sure on this, but I think it has something to do with RPC functions. I know I've been running a similar project, and my GUI wasn't doign the math on losing health until I put the losing health in an individual function and prefaced it with " @RPC " before the word function. I will keep looking, but maybe this can be used to help you. I think I saw something about assigning a NetworkID to the GUI? Hope this helps. Send me a personal Email and I will keep in touch if I find an answer.

more ▼

answered Apr 12 '12 at 09:28 AM

88bueno gravatar image

88bueno
10 5 8 8

(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:

x3681
x2996
x708
x106

asked: Dec 23 '11 at 05:11 AM

Seen: 572 times

Last Updated: Apr 12 '12 at 09:28 AM