Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
anarko67

JS Enter Exite Vehicle Network

Question

Hi guys ,

I have test the " enter exit vehicle " on network, (JS code)

I have a probleme with the name of networkplayer. 

name is "NetworkPlayer+photon.owner"

Please login or register to see this code.

 My wrong line : "GameObject.Find("NetworkPlayer(Clone)"+ photonView.owner).active=true;"

Have you a solution ?

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts


  • 0

i have test with tag . Enter no probleme but , exit " GameObject.FindWithTag("Player").SetActive(true);" its not good..

 

NullReferenceException
WehicleScript.Update () (at Assets/Car/Scripts/JavaScripts/WehicleScript.js:46)

Share this post


Link to post
Share on other sites
  • 0

Even when it's not lagging, you should remove it because Unity itself said that the function is slow if called every frame.

 

Remember this could accumulate over time depending on how much you are using.

GameObject.FindWithTag should only be used in AI in my opinion.

  • Like 1

Share this post


Link to post
Share on other sites
  • 0

hmmm ok i handerstand but :

GameObject.Find("NetworkPlayer(Clone)"+ photonView.owner).active=false;  NOT GOOD

Player.GameObject.active=false;  ( Error:Boo.Lang.Runtime.RuntimeServices.InvokeBinaryOperator) NOT GOOD

GameObject.FindWithTag("Player").active=false; NOT GOOD (Reason : accumulate over time depanding )

 

For what enter it's ok but exit is not good.

 

Help me please ?

Share this post


Link to post
Share on other sites
  • 0

New test (translate  CS) the oma "Wehicle" script.

But its the same problem.

NullReferenceException: Object reference not set to an instance of an object

Vehicl.Start () (at Assets/Car/Scripts/CSharpScripts/Vehicl.cs:31)

 

GameObject pl = GameObject.Find(PhotonNetwork.playerName+photonView.owner);

The probleme is the player name.

 

Please help me .

" invokplayernetwork.cs , have source code for the palyer name. "
Please login or register to see this code.

"Vehicl.cs"

Please login or register to see this code. Edited by anarko67

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...