Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by killa247 · Sep 10, 2014 at 12:56 PM · guiphoton4.6

[PUN] I want people to see my GUI

so what i am trying to achieve is when i press escape it doesn't open the other players GUI just mine, but the other players can see my GUI, i am using 4.6 world space gui.

i can open my gui but they dont see it at the moment.

Comment
Add comment · Show 12
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image kacyesp · Sep 10, 2014 at 01:58 PM 1
Share

@Landern It's pretty obvious what he wants. Goal: He hits the escape key, it opens his gui, and other players should be able to see it.

What he has currently: He can open his gui, but the other players don't see it.

avatar image Landern · Sep 10, 2014 at 02:06 PM 0
Share

@kacyesp have at it.

avatar image killa247 · Sep 11, 2014 at 04:34 AM 0
Share

is there any way to do this?

avatar image Landern · Sep 11, 2014 at 05:01 AM 0
Share

Are you using RPC calls and unity NetworkView's?

If you are and because you have given nothing to work with... i can only speak in concepts.

You would want prefabs for your menus. The menu's options and what have you would be referenced from the players gameobject or from a manager of some sort.

If the $$anonymous$$enu is yours, then you display it(assu$$anonymous$$g the positions are updated for the current users screen). If the menu is not yours, it should assume the transform/position close to the player on screen.

As a user transverses the menu, these changes to the state need to be sent to the appropriate player(s).

Again not knowing if this is a network thing... can't get more specific and you're not sharing your not as designed code/scripting which is not helpful, no screenshots, nothing.

avatar image killa247 · Sep 11, 2014 at 09:27 AM 0
Share

sorry i was at an internet cafe at the time i posted this, this is a picture of what i have at the moment... alt text

and what i need is the guest2581 to see that guest1727 is in his menu.

i am using the Pun network and unitys 4.6 gui worldspace.

the code is this to show the menu.

 public class animation : Photon.$$anonymous$$onoBehaviour {
     public GameObject player;
     public GameObject right_arm;
     public GameObject camera_1;
     public Canvas canvass;
     private $$anonymous$$enu_right mR;
     private $$anonymous$$ouseLook mL;
     private bool ll = false;
     private bool rr = false;
     private bool cursorL = true;
     Animator anim;
     Rigidbody body;
     PhotonView pv;
     void Start ()
     {
                 pv = player.GetComponent <PhotonView> ();
                 body = player.GetComponent<Rigidbody> ();
                 mR = right_arm.GetComponent ("$$anonymous$$enu_right") as $$anonymous$$enu_right;
                 mL = camera_1.GetComponent ("$$anonymous$$ouseLook") as $$anonymous$$ouseLook;
                 anim = GetComponent<Animator> ();
         }
 
     void Update ()
     {
                         if (Input.Get$$anonymous$$eyDown ($$anonymous$$eyCode.Escape)) {
                                 if (mR.$$anonymous$$enu == true) {
                 if (pv.is$$anonymous$$ine){
                                         mR.$$anonymous$$enu = false;
                                         mL.enabled = true;
                                         cursorL = true;
                                         Screen.showCursor = false;
                                         anim.SetBool ("$$anonymous$$enu", false);
                                         canvass.enabled = false;
                 }
                 else {canvass.enabled = true;}
                                 } else {
                 if (pv.is$$anonymous$$ine){
                                         mR.$$anonymous$$enu = true;
                                         mL.enabled = false;
                                         cursorL = false;
                                         Screen.showCursor = true;
                                         anim.SetBool ("$$anonymous$$enu", true);
                                         canvass.enabled = true;
                 }
                     else {canvass.enabled = false;}
                 }
                         }
 }


menu.jpg (159.6 kB)
Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Tricky7991 · Sep 12, 2014 at 10:40 PM

Hey,

I've seen some games with what you want. There is a couple ways to do this that I can think of. I kind of touched on one already which I will explain more on.

Basically it would be easier to make something to appear as the menu then to be a actual GUI. If you want to do a real GUI it would take some work but can be done. In a very similar way that I have made here.

preview

In the screenshot, I have a cube scaled and a texture of a GUI on it. No real GUI.

The way I have made here is pretty straight forward. And you could change it to anything that you would want.

 public bool menuTT = false;
 public GameObject menuGUI;
 
 void Start () {
     menuGUI.SetActive(false);
 
 }
 
 void Update (){
 
     if (networkView.isMine && Input.GetKeyUp (KeyCode.N) && menuTT == true){
         menuTT = false;
         networkView.RPC("Menufl", RPCMode.OthersBuffered, menuTT);
         }
 
     if (networkView.isMine && Input.GetKeyUp (KeyCode.M) && menuTT == false) {
         menuTT = true;
         networkView.RPC("Menutr", RPCMode.OthersBuffered, menuTT);
 
         }
 
     if (menuTT == true && networkView.isMine){
         menuGUI.SetActive(true);
         }
 
     if (menuTT == false && networkView.isMine){
         menuGUI.SetActive(false);
         }
 }
 
 [RPC]
 void Menutr(bool menuTT)
 {
     menuGUI.SetActive(true);
 }
     
 [RPC]
 void Menufl(bool menuTT)
 {
     menuGUI.SetActive(false);
 }

It works 100% tested it. You have to change it over to Photon's Networking though since its just using Unity's networking.


capture_2014_09_12_12_38_59_773.jpg (247.7 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by killa247 · Sep 12, 2014 at 11:20 PM

thanks, but ive done mine a slightly different way, both work i assume, just on your one, if a player had a gui opened if a player connected they wouldnt see if it was open or not (i think), anywhoo i cant up load the code because its too large, so heres the link on gist: link text

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tricky7991 · Sep 12, 2014 at 11:44 PM 0
Share

No problem, Yeah from what I saw of yours it should work. And yes $$anonymous$$e isn't buffered so it wouldn't appear for people connecting while its open. But I changed the script to fix that now. And it would be easy to fix that to have it work with the actual GUI and have the everything appear as it is on the other players.

Glad you were able to get it working though :) Watched the videos of you're game on youtube. It is looking pretty good! I'll keep my eye on it :D

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 4.6B UI Scrollbar Usage 1 Answer

When I pause my game and enable canvas and then resume my keyboard starts controlling the menu... 1 Answer

New GUI - nomenclature of blueprint (b) vs Raw (R) 0 Answers

How to have no alignment 4.6 GUI 0 Answers

GUI 4.6 Toggle Question. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges