playMaker

Author Topic: Refer to an object generated during runtime  (Read 91 times)

Justakin

  • Playmaker Newbie
  • *
  • Posts: 1
Refer to an object generated during runtime
« on: May 22, 2026, 04:08:10 AM »
I’m new to PlayMaker and Unity, so sorry if I’m not using the right terms.

I want to use objects that are created at runtime and reference them from other objects. Specifically, I want to click on a surface to spawn new objects, and then use those spawned points to draw a spline between them. However, it seems like I can only reference GameObjects that already exist in the scene. Am I missing something, or is what I’m trying to do not possible this way?

LeDisciple

  • Playmaker Newbie
  • *
  • Posts: 46
Re: Refer to an object generated during runtime
« Reply #1 on: May 23, 2026, 05:42:40 PM »
Hi,

My game I working on is ALL generated at runtime (to get a random level every time) so yes it's very possible. What you have to do is to create pool (a pooler is already on the Ecosystem) or Array Lists or hash tables depending of your needs. Search on the net for the difference between them. As an exemple for me: when I spawn a prefab on certain spot I put it's name (yes when they are created I change their name with an Int Loop to be more specific like 1,2,3,4,etc. not with the "(clone)" suffixe created by unity/playmaker) into an array and the Gomeobject with that name into an array too. So if I search for something like "by name", with the index of the array I can refering directly with the same index into the GameObject array. You can even save child object into an array, all depends of what you need.

As I said, it's an example for my needs, I do not know how you would proceed but play a lot with the Array/hash tables or Ecosystem Pooler. I use EasySave to save those array/hash and all the things created at runtime. When I open a saved game, I look if an EasySave files exists and my spaghetti code put everything where it belongs.

Have fun!  ;)
« Last Edit: May 25, 2026, 07:08:18 PM by LeDisciple »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4399
  • Official Playmaker Support
    • LinkedIn
Re: Refer to an object generated during runtime
« Reply #2 on: May 24, 2026, 06:56:56 PM »
Not sure if this is what you mean, but you can use the Store Object field in the Create Object action to store a reference to the GameObject you created.