• 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
Question by Matt 5 · Apr 04, 2012 at 01:57 PM · loadingtagspawning

Spawning in a specified location

Hi Everyone I've asked t$$anonymous$$s before in a different question but I have updated my code and I am going to use t$$anonymous$$s code in order to handle the spawning only t$$anonymous$$ng is I need some help in how to set up the spawning when I button is pressed.

Could someone please help me with t$$anonymous$$s?

Here is the code I am using.

 GUI.BeginGroup (Rect (Screen.width/2-300, Screen.height/2-200, 600, 500));
 GUI.Box (Rect (0,0,400,200), "Game lobby");
 

 var pProtected="no";</br>
 if(serverPasswordProtected){</br>
     pProtected="yes";</br>
 }
 GUI.Label (Rect (110,20,150,20), "Password protected: ");
 GUI.Label (Rect (250,20,100,100), pProtected);
 
 GUI.Label (Rect (110,40,150,20), "Server title: ");
 GUI.Label (Rect (250,40,100,100), serverTitle);

 GUI.Label (Rect (110, 60, 150, 20), "GameType Selected: ");
 GUI.Label (Rect (250, 60, 100, 100), serverGameTypeSelected);
 
 if (serverGameTypeSelected != "DM")
 {
     GUI.Label (Rect (110, 120, 150, 20), "Choose Team: ");
     //chooseTeamInt = GUI.Toolbar ( Rect (250, 120, 100, 20), chooseTeamInt, chooseTeamNames);
     
     PlayerPrefs.SetString("playerTeam","");
    GUI.Button(Rect(200,120,80,20),"Red");
    HostLaunchGame();
    
     PlayerPrefs.SetString("playerTeam", "");
     GUI.Button(Rect(280,120,80,20),"Blue");
    
       
 }
 GUI.Label (Rect (110,80,150,20), "Players: ");
 GUI.Label (Rect (250,80,100,100), currentPlayerCount+"/"+serverMaxPlayers);
 
 GUI.Label (Rect (110,100,150,20), "Current players: ");
 GUI.Label (Rect (250,100,100,300), players);

// GUI.Label (Rect (250, 330, 150, 20), "Choose Player");

/* if(Network.isServer){
if(GUI.Button (Rect (110,140,100,20), "Start the game")){
HostLaunchGame();
} }else{ GUI.Label (Rect (110,140,100,40), "Waiting for server..");
}

*/ GUI.EndGroup();
}

}

var lastRegTime : float = -60;
function Update(){
if(Network.isServer && lastRegTime lastRegTime=Time.time;
MasterServer.RegisterHost(gameName,hostSetting_title, "No description");
}
} function HostLaunchGame(){
if(!Network.isServer)
{
RedSpawnPoints = GameObject.FindGameObjectsWithTag("RedSpawnPoints");
return;
}
}

Comment

People who like this

0 Show 5
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 Kleptomaniac · Apr 10, 2012 at 04:36 PM 1
Share

You wouldn't catch me trying to read and decipher that even if you paid me. Please properly format your code and cut it down to relevant areas.

avatar image Matt 5 · Apr 10, 2012 at 04:55 PM 0
Share

I cut it down as much as I could while keeping the code I need help with

avatar image Matt 5 · Apr 13, 2012 at 02:08 PM 0
Share

I guess no one can help me with this I'm screwed I've been working at this code trying to figure it out for months now. Well thanks for the help or at least the views Everyone

avatar image Adamcbrz · Apr 14, 2012 at 08:01 PM 0
Share

I don't see where you are attempting to spawn anything. No one is probably answering because they don't understand what you are trying to do and where in this code you are having problems.

avatar image Matt 5 · Apr 16, 2012 at 03:09 PM 0
Share

I am having problems in the HostLaunchGame function. I want to able to choose I team color then spawn in the locations I specify based on the tag

2 Replies

· Add your reply
  • Sort: 
avatar image

Answer by yezzer · Apr 14, 2012 at 08:08 PM

  1. Format your code correctly.

  2. What exactly are you trying to do? We need more specific information.

  3. What is going wrong? Your code isn't really doing anyt$$anonymous$$ng..

Comment

People who like this

0 Show 0 · 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

Answer by reptilebeats · Apr 16, 2012 at 03:26 PM

if i understand right all you want to do is spawn at a point when a point is pressed a lot like a check point system, best way or rather simplest is have a checkpoint manager script w$$anonymous$$ch is not destroyed and have the checkpoints update the position in the manager, then when u reload the level assign the either the instantiatian to it or what ever

Comment

People who like this

0 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 Matt 5 · Apr 16, 2012 at 07:13 PM 0
Share

Actually what I want to do is have the player spawn in a location based on the tag I give them after Team Red or Blue is pressed at the main menu

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

Remmember the spawner 2 Answers

Spawning Player After Player Choice. 1 Answer

little animated loading disc thing in iOS 0 Answers

problem with set tag in unity network 0 Answers

Spawning random prefabs with the same tag 2 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