playMaker

Author Topic: SOLVED:Photon Grounding error  (Read 5633 times)

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
SOLVED:Photon Grounding error
« on: December 01, 2015, 05:54:33 PM »
Hi,
In trying to get my new Photon game to work (see other recent threads) I think I have a clue why synchronisation is iffy... jumpy, and sometimes REALLY jumpy.

I have a red error:

NullReferenceException: Object reference not set to an instance of an object
UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter.CheckGroundStatus () (at Assets/Standard Assets/Characters/ThirdPersonCharacter/Scripts/ThirdPersonCharacter.cs:215)
UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter.Move (Vector3 move, Boolean crouch, Boolean jump) (at Assets/Standard Assets/Characters/ThirdPersonCharacter/Scripts/ThirdPersonCharacter.cs:54)
UnityStandardAssets.Characters.ThirdPerson.ThirdPersonUserControl.FixedUpdate () (at Assets/Standard Assets/Characters/ThirdPersonCharacter/Scripts/ThirdPersonUserControl.cs:71)

I thought it had something to do with the Behavior Setup FSM. This is supposed to turn ON the third person controller IF its yours... (and the camera in the demo, but IM using a different camera that is external to the character)

The demo originally had the old 3rd person controller specified here but as Ive gone over to Mechanim, and using EXACTLY the new Standard Assets 3rd Person (with new skin) I think the equivalent script is the Third Person Character script.

So I deleted the old action and drag in the component, add enable.. and all is sort of OK... judders a bit, but maybe thats tweaking... BUT I get the above error---

And now heres my action to enable the script...


So... the clue for me is... CheckGroundStatus
Cos if that script is removed from the remote player, that one seems to have a Ground Check Distance field, maybe it needs one?

Its not KILLING my game, but +999 red errors doesnt seem very friendly...

Mark
« Last Edit: December 04, 2015, 05:08:18 AM by markfrancombe »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Grounding error
« Reply #1 on: December 02, 2015, 01:00:32 AM »
Hi,

 is it happening on both player or on just one, it could be that the player that is controlled by the network should not have its character controller active, as it conflicts with the networkview setting the position and rotation.

 so on the player that is not "is mine", make sure you have it setup properly so that it doesn't do anything and let the network view handle the synch.

 Bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon Grounding error
« Reply #2 on: December 02, 2015, 02:30:57 AM »
Yes thats exactly what I think.
Amd yes, its only giving the error on the network controlleed character. Before I launch a second client, the Player runs around perfectly, with no errors.

But thats what Im trying to do (and we are suppose to do) with the behaviour FSM right? My fear as I mentioned, is that disabling it on the network player is what is causing the error. Indeed, if I DONT disable it (or rather ENABLE IT, it starts life disabled, its the behaviour script that enables it for the Users Player) THEN I dont get any errors, however both characters move when you try to control one. Not exactly, your character moves correctly and the network character, rotates and plays a few animations dependant on what you are doing on the Is Mine Player...

When you say character controller, you are not, I presume, referring to the generic "old skool" character controller component, that was shipped as part of the previous versions of Standard assets third person prefab, rather you mean, the "character controller that I am NOW using" that is shipped with the U5 third person, mechanim friendly "Third Person Character script".

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Grounding error
« Reply #3 on: December 02, 2015, 11:45:19 AM »
Hi,

 indeed I was referring to the old Character controller.

 I never worked with the new version, so I can't help you right now on this, but I suspect the principle is the same, you need to turn it off when the player is not supposed to be controlled by the User input but rather by the networkview.

If this is the characterController you are working with: http://docs.unity3d.com/Manual/class-CharacterController.html

then, Photon comes with a ready made sample showing how to set it all up without code, check out the DemoMecanimScene and the prefab "Robot Kyle Mecanim"

let me know how it goes.

 Bye,

 Jean



 Bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon Grounding error
« Reply #4 on: December 02, 2015, 05:16:13 PM »
Hi,

 indeed I was referring to the old Character controller.

 I never worked with the new version, so I can't help you right now on this, but I suspect the principle is the same, you need to turn it off when the player is not supposed to be controlled by the User input but rather by the networkview.
oh dear
If this is the characterController you are working with: http://docs.unity3d.com/Manual/class-CharacterController.html
No its not... its new in Standard Assets..

then, Photon comes with a ready made sample showing how to set it all up without code, check out the DemoMecanimScene and the prefab "Robot Kyle Mecanim"

OK will go and check... sounds like its not up to date either... but maybe I should revert to that, if its ok with mechanim the rest of my shit should work?


« Last Edit: December 03, 2015, 04:04:50 AM by markfrancombe »

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon Grounding error
« Reply #5 on: December 02, 2015, 06:07:16 PM »
Just checked.. as far as I can see it doesnt have any disabling going on...
too tired to think now... tomorrow is another day...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Photon Grounding error
« Reply #6 on: December 03, 2015, 12:26:13 AM »
Hi,

 One thing, your google doc content is private so we can't see what your are adding to the posts.

-- Can you give me the related url link to the documentation of this controller you are using?

 Bye,

 Jean

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon Grounding error
« Reply #7 on: December 03, 2015, 04:18:39 AM »
Hi,

 One thing, your google doc content is private so we can't see what your are adding to the posts.

Bugger... sorry, I guess cos I am logged in to my private I can see them ok... moved to Imgur... Dont think they were exactly groundbreaking, with any big clues however...
-- Can you give me the related url link to the documentation of this controller you are using?

 Bye,

 Jean

UM... I go have a look to see if such a thing exists.. but in the meantime, Ill just attached the actual scripts. These are:
ThirdPersonUserControl.cs
ThirdPersonCharacter.cs

there is also an optional script for AI
AICharacterControl
(but IM not using it, but I have included it below so a)you get the whole package and b) maybe theres something to be grabbed from it.. you know... swap to this IF NOT MINE.. for example.. I dunno..)

In the folder there is also a README file that I have also included below, but its just general information on how to swap models...

To repeat.. If you download Standard Assets Characters packages, this is what you get now, no more Demo Worker. I VERY easily just chucked in a new character from Fuse/mixamo and made no changes, so I approve of this controller, or I might swap completely to the one you pointed me to in Photons demo, which as you say IS mechanim, but still using character controller...

Ill look for more detailed info on these scripts at Unity... in the meantime I hope they can tell you something...

markfrancombe

  • Sr. Member
  • ****
  • Posts: 338
Re: Photon Grounding error
« Reply #8 on: December 04, 2015, 05:08:04 AM »
Quick message to say I solved it... and it was, of course, very simple...
I checked the script that was erroring, and although I cant code, I figured out in mono develop which variable(or function or whatever the f*** it is) was trying to access the thing that was the error, IE: the IsGrounded thing. and it was the OTHER script, the ThirdPersonUserControl script, so I modified my behaviour FSM to disable that one as well (or rather, I disabled it, and ENABLED it if it was MINE)

And it worked, the error has disappeared. The network player is still a bit jerky (maybe the same) I was hoping that the +999 errors was hogging something and causing the jerkiness, but it might be just tweaking of the photon transform view interpolation settings.. so any help regarding THAT issue would still be appreciated, but Ill make this thread as SOLVED.

Mark

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: SOLVED:Photon Grounding error
« Reply #9 on: December 08, 2015, 12:50:22 AM »
Hi,

Yep, that's what I meant by "Active", I should have word it differently.

 I am glad you solved this!

Bye,

 Jean