Saving a reference using Playmaker

Discussion and help for Easy Save 3
Post Reply
Binkey
Posts: 2
Joined: Wed Sep 01, 2021 9:02 pm

Saving a reference using Playmaker

Post by Binkey »

This might be a stupid question, but how do I save just a reference to a game object using playmaker?

I'll try to explain the scenario I'm trying to accomplish.

I have a gameobject (wire) with an FSM that has two gameobject (pins) variables that it uses to position itself. I want to save the reference to these two objects and load them back into those variables at runtime. What really happens when I save those variables, is that it saves everything to do with those game objects (pins) (name, enabled, all components and their values, etc.), and when I load those variables, it just applies all those properties to the game objects (pins) I'm trying to reference and the pins variables are null.

I understand that when you save a gameobject with easy save, it's supposed to save all information accompanying that gameobject, but I simply want a one line, reference value to it, as if I were saving it as an integer or a string.

Thank you
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Saving a reference using Playmaker

Post by Joel »

Hi there,

To do this with PlayMaker you would need to create a script with a GameObject field and save this script. Fields of UnityEngine.Object types are stored by reference. Once loaded, you can then set your variable to the value of this field.

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Binkey
Posts: 2
Joined: Wed Sep 01, 2021 9:02 pm

Re: Saving a reference using Playmaker

Post by Binkey »

Fantastic.

This worked perfectly for me. Thank you for the great tool. :)
Post Reply