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 PogyManTV · Jan 07, 2016 at 10:13 PM · networkingmultiplayerserverdoubleclients

Unity Network Double Damage problem

So i'm using Unity 4 i now it is like 2 months that i have the folowing problem today i write my own dynamit script which take damage over netowrk from player when it get's exploded so when is only one client on the server the dynamit is working properly it takes the player damage but the problem comes when another player connects to the server why? because the dynamit damage get doubled for example the default dynamit damage is 45 health when another player connect to the server the damage is now 90 when anoter player connects now there are 3 connected players the damage is 135 so this is all and i have no idea what i have to do i'm so confused because this is the only problem i never had problems with networking but this is getting me very bored :/

here is the code to Dynamit

 using UnityEngine;
 using System.Collections;
 
 public class DynamitExplode : MonoBehaviour {
 
     public float damage = 45;
     public bool canExplode = true;
     public bool explodeNow = false;
     public GameObject particles;
     public float timer = 6;
     public float counter = 0;
 
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
 
         if(Network.isServer)
         {
             if(canExplode)
             {
                 counter += Time.deltaTime;
             }
             if(explodeNow)
             {
                 Network.Instantiate(particles, transform.position, transform.rotation, 0);
                 Network.Destroy(gameObject);
             }
             if(counter > timer)
             {
                 explodeNow = true;
             }
         }
     
     }
     void OnTriggerStay(Collider col)
     {
         if(explodeNow)
         {
             if(col.gameObject.tag == "Player")
             {
                 col.networkView.RPC("DynamitHit", RPCMode.All, damage);
             }
         }
     }
 }


So please is there anybody who can help me with this i will appreciate any help from you thanks :) PS: sorry for bad language :/

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

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Unity networking tutorial? 6 Answers

Best cross platform Http Library? 1 Answer

Non-dedicated server? 1 Answer

Save and Load JSON Data to and from Webserver, Performance Question 0 Answers

Networking - 1on1 based on Player's level 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