Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: refinedgames on October 25, 2013, 03:25:33 PM
-
Hi Guys,
I'm porting from UnityScript to C#. The following works in US:
aiStrategyFSM.Fsm.EventData.IntData = shotTypeIndex; //aiStrategyFSM is my FSM component reference, shotTypeIndex is my int var
aiStrategyFSM.SendEvent(checkStrategy);
The same code in C# throws error: "Static Member 'HutongGames.PlayMaker.Fsm.EventData' cannot be accessed with an instance reference, qualify it with a type name instead.
So according to this thread
http://hutonggames.com/playmakerforum/index.php?topic=84.msg484#msg484 (http://hutonggames.com/playmakerforum/index.php?topic=84.msg484#msg484)
I tried the following in C#:
Fsm.EventData.IntData = shotType;
aiStrategyFSM.SendEvent(checkStrategy); //send event code
But the Fsm.EventData... line throws an error: "Fsm" does not exist in the current context. What am I missing? My C# skills are not great... yet. :)
-
OK, surrounding my code with 'namespace HutongGames.PlayMaker.Actions' makes it compile but now other scripts don't recognize my script (so more compile errors). This could be trouble. Any easier way?
-
Hi,
What are the errors?
bye,
Jean
-
Thankfully I solved this. If anyone else tries to use Fsm.EventData... in any C# script you must include:
using HutongGames.PlayMaker; //the namespace Fsm.EventData belongs to
at the top of your script. Otherwise Fsm.EventData is not recognized.
If you are making a custom action using Fsm.EventData (such as SetEventData.cs), then wrap your script in
namespace HutongGames.PlayMaker.Actions
{
}
This is now [SOLVED] if someone wants to update the Subject Title (or can I do that?).