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

Spawning in a specified location

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

Could someone please help me with this?

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
Add comment · 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 $$anonymous$$m color then spawn in the locations I specify based on the tag

2 Replies

· Add your reply
  • Sort: 
avatar image
0

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 anything..

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 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 which 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
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 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.

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

Spawning Player After Player Choice. 1 Answer

How do i make an object spawn another one? 1 Answer

Loading scenes from my menu breaks a script that usually works... 0 Answers

Remmember from where it spawned. 1 Answer

Loading Spawn points based on decision 1 Answer


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