Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Ragequit0605 · Apr 15, 2017 at 12:02 PM · networking

Why doesn't an object appear on both screens? (Unity networking)

 #pragma strict
 import UnityEngine.Networking;
 class Queue extends NetworkBehaviour
 {
 var Car : GameObject;
 var queueing : boolean;
 var timer : GameObject;
 var manager : GameObject;
 function Start () 
     {
         ClientScene.RegisterPrefab(Car);
         timer = GameObject.Find("GlobalTimer");
         manager = GameObject.Find("NetworkManager");
     }
 
 function Update () 
     {
         if(Input.GetKeyDown(KeyCode.F2))
             {
                 queueing = !queueing;
                 Debug.Log(queueing);
             }
 
         if(queueing == true && timer.GetComponent(RaceTimer).starting == true)
             {
                 CmdSpawn();
             }
 
     
     }
 }
 
     function CmdSpawn()
         {
             var c = Instantiate(Car);
             NetworkServer.Spawn(c);
             Destroy(gameObject);
         }

That's my script but when I spawn the car , it doesn't appear on both screens nor does it think it's a "localplayer"? Any help?

Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by p1g30n · Apr 16, 2017 at 09:16 PM

I really can't tell what is the problem, because there might be some, but I am sure that video will help you if you do and check every step made in this video. https://www.youtube.com/watch?v=V6wEvT6G92M&t=3275s&list=WL∈dex=33

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 Ragequit0605 · Apr 27, 2017 at 08:50 PM 0
Share

It's fine, i'll just do it in C# and replicate what I see in the video as networking doesn't seem to work with Java. Thanks

avatar image
0

Answer by Delforce · Apr 17, 2017 at 07:32 PM

From what I can tell by the code it seems that possibly your destroying the gameobject of the Car that your wanting on the network. What happens when you don't destroy the gameobject?

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 Ragequit0605 · Apr 27, 2017 at 08:49 PM 0
Share

I'm not destroying the car. I'm spawning the car on the network while walking around on foot with a spawner script which then destroys the fps character. The car spawns on one but not both screens.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Spawn GameObjects before client joins? (Mirror Networking) 0 Answers

Why I cant use 2 NetworkManagers in the same time? 0 Answers

InvalidProgramException: Invalid IL code? Mirror 0 Answers

Multi-threading safely 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