playMaker

Author Topic: Problems getting and setting GameObject Variable  (Read 320 times)

JLawton

  • Playmaker Newbie
  • *
  • Posts: 9
Problems getting and setting GameObject Variable
« on: November 09, 2022, 12:11:10 PM »
Hi, i'm trying to do something which I thought would be relatively simple but i'm struggling (possibly because it's been ages since I used Playmaker properly).

We have some custom properties on an imported object and we need to access it, someone wrote some code for us and all we have to do is get the GameObject and set the property of the code variable to that GameObject so it can get the correct data, then we can output that data to a UI.

The way I thought it would work was clicking on an object which would create a raycast, this would let me access the GameObject property and set the code to use that object. In practice, the only way i've been able to do it so far is using the Mouse Pick Action with Get Raycast Hit Info and Set Property on the actual GameObject.
This would be fine if we only had a few objects in the scene, but it's a large imported CAD file and there are hundreds of components i'd have to copy the FSM to.
I'm hoping i've missed something obvious, but if anyone has any suggestions they'd be greatly appreciated.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Problems getting and setting GameObject Variable
« Reply #1 on: November 11, 2022, 11:26:46 PM »
Hi.
Try to avoid using "Set Property"
You could ask the guy who made the script to help make some actions to access the script.

Here are some tutorials for creating custom actions :



For mouse pick you can get the game object directly (its not needed to use hit info)

Get/Set Property are mirroring and therefore slow and can not handle multiple objects.