- Home /
Question by
steelesound · Oct 13, 2014 at 05:33 AM ·
errorlevelpublicprotection
Getting the error "is inaccessible due to it's protection level" when I have the function set to public.
So I'm working with Wwise and I've followed what's in the Wwise documentation to make the following script:
using UnityEngine;
using System;
using System.Collections;
public class ScratchPad : MonoBehaviour {
void Update() {
if (Input.GetButtonDown("Fire12"))
GetComponent<AkTriggerOnKeyPress>().Keypress();
}
}
That script is meant to work with:
#if ! (UNITY_DASHBOARD_WIDGET || UNITY_WEBPLAYER || UNITY_WII || UNITY_NACL || UNITY_FLASH || UNITY_BLACKBERRY) // Disable under unsupported platforms.
//////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2014 Audiokinetic Inc. / All Rights Reserved
//
//////////////////////////////////////////////////////////////////////
using UnityEngine;
using System;
using System.Collections;
public class AkTriggerOnKeyPress : AkTriggerBase
{
void Keypress()
{
if(triggerDelegate != null)
{
triggerDelegate(null);
}
}
}
Any help on this would be appreciated, I am completely stumped as to why my script (top) is having this issue.
Comment
You need to make the method '$$anonymous$$eypress' public as well:
public void $$anonymous$$eypress()
Answer by Kiwasi · Oct 13, 2014 at 06:17 AM
Some clarification. In C# if you don't specify an access modifier the default is private.