Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Wesley21spelde · Jan 22 at 10:49 PM · serializationstreaminglayerweight

streaming layerweight onserializeview

hey guys i am struggling with streaming of my layer weight i have multiple layers on my character on my side it works all other animations on the base layer are streaming and receiving but my animation on layer 4 isnt because i cant seem to get this right i tryed google i do know it wants a float weight but i dont understand isnt the float alreddy done in my client/my side ?. ................................................................................................................................................... ......OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)....

 stream.SendNext(anim.SetLayerWeight(4, (float)); // this one it says invalid expression term
 anim.SetLayerWeight(4,(float)stream.ReceiveNext()); //this one i didnt get error

this is how i did my layer weight

 if (isFiringGun == true)
         {
             currentWeight = Mathf.Lerp(currentWeight, 2.0f, Time.deltaTime); anim.SetLayerWeight(4, currentWeight);
             
         }
         if (isFiringGun == false || Input.GetMouseButtonUp(0))
         {
             currentWeight = Mathf.Lerp(currentWeight, 0.0f, Time.deltaTime); anim.SetLayerWeight(4, currentWeight);
             
         }




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
0

Answer by Bunny83 · Jan 23 at 04:36 AM

Well this line:

 stream.SendNext(anim.SetLayerWeight(4, (float)); 

makes no sense on multiple levels. First of all SendNext expects a value that it should serialize and send over the network. However SetLayerWeigth does not return any value, so you can not pass the result to SendNext. Furthermore the second argument of SetLayerWeight should be the weight value you want to set. Though you currently have (float) there which makes no sense.


If you want to send your current layerweight you either want to send your "currentWeight" value, or if the sending happens on a seperate script, you probably want to use GetLayerWeight instead of SetLayerWeight in the offending line.

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 Wesley21spelde · Jan 23 at 07:10 AM 0
Share

hi how are you thanks for the help it worked atleast for the sending part. i dont want to sound verry stupid but i tried the receiving like this and it doesnt work anim.SetLayerWeight(4)stream.ReceiveNext(); i checked https://docs.unity3d.com/ScriptReference/Animator.SetLayerWeight.html and as far as i get it it wants a float anim.SetLayerWeight(4,(float)stream.ReceiveNext()); but still not working all my other animations on the base layer do stream correct and receive ill be honest i am not good at this kind of code for strea$$anonymous$$g :(

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

139 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

Related Questions

Play 2 animations at once 4 Answers

How do I smoothly shift between Layer Weights 2 Answers

[UNET] sending large files over network 0 Answers

Writing binary files on Android 1 Answer

Animation Controller not returning character to correct position. 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