Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Yamanlar · Aug 07, 2015 at 10:26 AM · animationphotonunity 4.6

Photon Play Animation

Hi Everyone! How can i play animation with Photon? (without animator)

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

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by 334499p · Aug 15, 2015 at 07:54 AM

What you are asking is kind of generic so...

PUN has two types of network objects... player network objects and scene objects. A scene object is an object that is owned by the photon network and if the masterclient leaves then it remains in the game (great for enemies). Player network objects are more temporary objects and only exist as long as their owners are connected. So the player model could be a player network object and is controlled directly by that player, not the scene. For scene objects you need to use RPC calls to update information across the network but for player network objects it could get more complicated if you want to increase optimization/limit your RPC calls by using OnPhotonSerializeView. Any type of object that's going to be synced across the network (besides preplaced map details) is going to require a PhotonView. So for your object with the animation an RPC call is probably the best way to go about it because i'm not sure if its a scene object or not.

On the object that you are animating add a PhotonView and then create a script and add the following to the Update() function:

   if(Input.GeyKeyDown(KeyCode.Space)){
   GetComponent<PhotonView>().RPC("playAnimation", PhotonTargets.All, null);
   }

add the following RPC call after the Update() Function:

 [RPC]
 void playAnimation(){
 GetComponent<Animation>().Play();
 }


What this script does is activate the object's animation if a player presses the space bar. When the space bar is pressed then the PhotonView on the object tells its self across the network to play the animation. This script functions whether or not the object is a scene object or player object. The object is present on every client across the network but it is unaware if itself across the network. Using the RPC call tells its PhotonView to communicate with itself across the network to let itself to execute the animation.

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 Yamanlar · Aug 17, 2015 at 09:23 AM 0
Share

Thank You!

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

Can we use "Photon cloud" for a card game like poker in Unity3d? 1 Answer

Photon Networking - Getting RoomList inside a Room 1 Answer

Photon Networking Player Control Issue 1 Answer

Photon Syncing Animations 2 Answers

Two Photon problems 0 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