Cant synchronize hitbox

Hello, I'm making a 1v1 2d fighting game and I cant quite get the meele hitbox right.

both player connect, spawn the player prefab and have synchronized movement and animation. However the meele hitboxes do not work.

My plan:

1)In the player prefab, make a child gameobject called MeeleHitbox with collider2D

(isTrigger true) and give it a tag called Meele Hitbox.

2)Give the player prefab onTriggerEnter2D and look for collider with the tag.

3)Active and Inactive based on user input.

Problems:

1) Players ignore each other Hitboxes.

it has something to do with it being a child object/photon instantiated because I tried adding the same gameObject to the scene and the Trigger was called.

2)I can't get them to synchronize.

For testing, I tried the following code to make them Inactive:



The log I used just before the ReceiveNext was called only twice at the beginning and

Hitboxes got inactive only in one screen:(they are the white squares)

The hitboxes have both photon view and photon transform view classic.

please help.

Answers

  • Tobias
    Tobias admin
    edited September 21

    I have to say: PUN is really not the best basis to create a fighting game. It is not tuned for high frequency updates and does not help with anything but state transfer.

    You would be better off using Fusion or Quantum for this type of game (where exact positioning of hitboxes plays a central role).

    If a PhotonView is on a disabled object, it will not get updates. You may want to arrange this in a way that allows the PhotonView to stay active (and only disable whatever needs to be disabled).