playMaker

Author Topic: variable only gets SET in inspector when I stop my game :s[SOLVED]  (Read 884 times)

evilpikmin

  • Playmaker Newbie
  • *
  • Posts: 16
Hi all, this has got to be user error but here goes:

I am using Set FSM Vector3 to set a Vector3 variable on a global prefab but the inspector only seems to show me the updated values when I stop my game. All help appreciated!

Cheers
« Last Edit: July 05, 2019, 10:14:30 AM by jeanfabre »

evilpikmin

  • Playmaker Newbie
  • *
  • Posts: 16
Re: variable only gets SET in inspector when I stop my game :s
« Reply #1 on: July 04, 2019, 06:31:42 AM »
I'll reply to myself here and say that Im pretty sure that this is related to prefabs not being set up correctly to reference each other :S

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: variable only gets SET in inspector when I stop my game :s
« Reply #2 on: July 04, 2019, 08:23:41 AM »
Hi.
Prefabs can not communicate directly to scene objects

if you drag in a prefab manually you can drag/drop the scene object to reference into the actions (or use a variable and drop it in there, wich would be a better way to do so) withing the scene.
you will need to do this every time you drag an object from the project window to the hierarchy.

if prefabs are created @ runtime, they need to get a reference 1st to that object.

There are a few ways to do so.

Find game objects would be the easiest but not performance efficient especially if you would use many objects.

another way you can do is :
When creating the object, store it into a variable, then use "Set Fsm Game Object"
Target the created object and set the object you want to communicate with.

Maybe this video can help a bit :


evilpikmin

  • Playmaker Newbie
  • *
  • Posts: 16
Re: variable only gets SET in inspector when I stop my game :s
« Reply #3 on: July 05, 2019, 08:53:46 AM »
Great video! thank  you very much. Hopefully I will stop making the same mistake over and over again now :)

Cheers!