playMaker

Author Topic: Protection Level Error in Photon Demo Scene script [SOLVED]  (Read 3762 times)

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Protection Level Error in Photon Demo Scene script [SOLVED]
« on: March 18, 2013, 12:27:28 PM »
I'm having a bit of trouble getting the Demo scene for the Photon addon to work nicely with my project. 

"Assets/Photon Unity Networking/PlayMaker/Demo/Script/PlayMakerThirdPersonControllerProxy.cs(29,57): error CS0122: `ThirdPersonController._characterState' is inaccessible due to its protection level"

Is there a more recent version of the demo?  I noticed that PlayMaker downloaded from the Asset Store doesn't include it, but all the versions of the demo package I've found produce this error when Unity is loaded.

Thanks.

« Last Edit: March 20, 2013, 12:59:11 PM by Alex Chouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Protection Level Error in Photon Demo Scene script
« Reply #1 on: March 19, 2013, 01:16:49 AM »
Hi,

 uhm... I really wonder what could have gone wrong here.

can you open the script "ThirdPersonController" and tell me if you have at line 31 exactly:

    public CharacterState _characterState;

if not, then some kind of version issue exists that that scripts. it's _characterState is private or protected, simply change ti to public.


bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Protection Level Error in Photon Demo Scene script
« Reply #2 on: March 19, 2013, 09:53:42 AM »
At line 31 is return 0;

I have no lines that address characterState_characterState.

There is a public Int that is characterStateIndex, and there was one private variable that was ThirdPersonController _controller.  I changed that last one to public, but it did not fix the problem.

Here is the script in full:

Code: [Select]
// (c) Copyright HutongGames, LLC 2010-2012. All rights reserved.

using UnityEngine;
using System.Collections;


/// <summary>
/// Play maker third person controller proxy.
/// This proxy simply allow playmaker top access the CharacterState enum of a ThirdPersonController. This is necessary until PLaymaker supports enums access.
/// This proxy also prevents having to modify the ThirdPersonController script. So that we can provide a better port and show this kind of options when
/// users wonders about integrating existing scripts and find themselves into similar situations.
/// </summary>
[RequireComponent (typeof (ThirdPersonController))]
public class PlayMakerThirdPersonControllerProxy : MonoBehaviour {


/// <summary>
/// Gets or sets the index of the character state. Use "set property" and "get property" within playmaker to access this variable.
/// </summary>
/// <value>
/// The index of the character state
/// </value>
public int characterStateIndex
{

get{
if(_controller!=null)
{
return (int)_controller._characterState;
}
return 0;
}

set{
if(_controller!=null)
{
_controller._characterState =  (CharacterState)value;
}
}
}

/// <summary>
/// The ThirdPersonController component pointer.
/// </summary>
private ThirdPersonController _controller;


/// <summary>
/// Get the ThirdPersonController pointer.
/// </summary>
void Awake()
{
_controller = GetComponent<ThirdPersonController>();
if (_controller== null)
{
Debug.Log("ThirdPersonController component could not be found.");
}
}
}

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Protection Level Error in Photon Demo Scene script
« Reply #3 on: March 20, 2013, 02:47:55 AM »
Hi,

 this is not the script I'd like you to look at. This is only the script that tries to access what seems to be not available.

you need to open "ThirdPersonController" script.

bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Protection Level Error in Photon Demo Scene script
« Reply #4 on: March 20, 2013, 12:04:45 PM »
That got it.  Thank you for your help.