Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: sebaslive on January 31, 2019, 06:57:07 PM
-
I used another action as an example to convert an FsmObject to another class found in a different asset. In play sound we have
var audioClip = clip.Value as AudioClip;
but in my script I get an error saying "Cannot convert type 'UnityEngine.Object'..."
What are other ways of getting the FsmObject to convert type when getting this error?
Thank you
-
Hi,
can you show the script in question that gives the error?
Bye,
Jean
-
Heres the line in my script:
public SteamVR_Action_Vector2 vector2Action;
[ObjectType(typeof(SteamVR_Action_Vector2))]
public FsmObject vector2Action;
public override void OnUpdate()
{
var vector2 = vector2Action.Value as SteamVR_Action_Vector2;
}
And attached is the script it's trying to connect to.
-
I've also created some custom actions for SteamVR 2.2 and are running into the same problem :P
The SteamVR_Input_Actions are no longer "scriptable" as before, so i'm just using a string as input for now.
public FsmString vector2Action;
var action = SteamVR_Input.GetAction<SteamVR_Action_Vector2>(vector2Action.Value);
I'ts not ideal, but it works for now.
-
Hey Dennis!
I am using an alternate method for the toolkit as well but like you said, its not ideal. I'm hoping playmaker team may know of another method that can bypass this for the actions.
-
Any ideas Jeanfabre?
Thanks
-
Hi,
Well, If the new api doesn't objects but simple classes, then yes, you won't be able to store these reference in a an FsmObject.
for this, you'll need to use soft referencing by keeping a static dictionnary of string acting as keys and the SteamVR_Action_Vector2 class or other classes.
in your actions, you'll use the string key to store and use that SteamVR_Action_Vector2 class. That's how I handle such case, for example when dealing with xml nodes.
Bye,
Jean
-
Gotcha thanks Jean and thanks for your input as well Dennis!
-
Not that i was much help but you're welcome :P
Good to see we finally have a proper solution to this.
Well i guess i'm gonna have to do some research into soft referencing then ;D