As long as I press a key (that I specify in InputManager) an Action is executed and stays until I release it and it goes back the way it was before. In short to 'momentarily' turn something on with a key and hold it until I release it.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I created the script you mention and place it inside an empty Object ,then I make an Object:SendMessage,
Object to affect: my EmptyObject,
Message to send: Custom,
Method name: Update
But when I useplace the Interact function ACActionList.Interaction() it says I need an (int,bool) ???
void Update( )
{
if (Input.GetKeyDown (KeyCode.Space)) {
Debug.Log ("Space key was pressed.");
AC.ActionList.Interact (); ?????????????????
}
if( Input.GetKeyUp( KeyCode.Space ) )
Debug.Log( "Space key was released." );
}
I am at a loss as far as the flow of these, I would appreciate help
As for Interact, you need to call the function from an instance of the ActionList class - not the ActionList class itself. This isn't a programming forum or a guide for coding in Unity, but basically:
// Put this outside the Update() function
public AC.ActionList myActionList;
// Replace your current Interact call with:
myActionList.Interact ();
You'll then see "My Action List" appear in the Inspector for you to assign.
I have done it another way by clicking the special key once to do it and again to undo it since I still don't understand your solution.
Incidentally, AC. functions like AC.ActionList and others of that kind do not exist in Unity itself but is a byproduct of Adventure Creator therefore I asked this Forum instead of Unity's
First, thank you.
I don't have any script errors any more however I am unable to drag any actionList asset in the inspector. Here is what the Inspector shows
-------------------------------------------------
ToggleKey (an empty GameObject
ToggleSwitch (script)
My Action List: None (Action List)
----------------------------------------------
and I can't drag any of my 20 something ActionList Assets into the My Action List however it accepts Cutscenes assets, so I copied the contents of my ActionList into a Cutscene and then it works.
Try it if you want, why does it accept Cutscenes and not ActionList ? I personally don't care as long as the results are OK.