• 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 Abdulrahman_alhmdani · Feb 27, 2020 at 11:16 AM · networking

How can I change a variables in and between spawned Objects

First of all I have a game where you have 2 players empty objects "1 for client and one for the the other one" both players select their teams then they have to click on number 1 to spawn an Object "Humvee" the problem is I can't control the health of the spawned object "Humvee" when it attacks the other game object in fact I can't make it attack the other objects because I don't know a way to synchronize the operation between the spawned objects , Of course I used "local player authority" on the spawned objects scripts but to no avail I can't use [Commands] nor [RPC client] because these are a spawned objects by the player! this is I used network transform so I could synchronize the location and movement but I don't know how to synchronize the health and attack function please help ! alt text this is a picture of my game I'm really new to networking so thanks in advance for any help

fdfdfdf.png (340.3 kB)
Comment
Add comment · Show 1
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 tormentoarmagedoom · Feb 27, 2020 at 02:57 PM 1
Share

Hello.

I dont get exactly your problem (I'm not used to do server/client projects) But I'm sure you need to focus on your problem step by step.

Try to de a more simple example of the functionality you need, go look for some tutoprials about this, etc.

If the problem is that this new objects are spawned from the client, this is the problem... As far as I know, all objects should be instantiated from the server, and then the clients "follow" the server. If is the player who "decides" to spawn, then send a command to the server and let the server spawn that.

I dont know if this helps, but as i said, like everything while learning to develop and program, take your time, step by step, dont worry for spending time reading/watching tutorials.

Good luck my firend!

1 Reply

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

Answer by Abdulrahman_alhmdani · Feb 28, 2020 at 12:21 AM

Hey thanks for helping and luck I have already found the answer and will share it in case someone has the same problem but IDK if this is a good solution or not , the problem is "When I spawn the objects from "Player object script " the new spawned objects have script too , the real problem in this this is when any value in these new objects got changed no one will know about it "Because I cant use syncvars and commands outside player object "so I changed from giving local player authority to (Is server) but without using any RPCS this time and it worked !" thanks again

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

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

167 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

TcpClient not working when building, 1 Answer

[Unity3d 5.1] Multiplayer - Multiple match - dedicated server 1 Answer

TargetRpc not sending atribute (Mirror) 0 Answers

How to instanciate player prefab in a OnLobbyServerSceneLoadedForPlayer override ? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges