Call object by name after being created

0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm creating a very complicated menu system, and I'm still figuring out where I want things placed, what size I want things, etc. etc. So I'm moving a lot of parts around, and would love to figure out a way to make it easier on me.

    Long story short, if I create an object by name, can I reference that object after it's created?

    ie:

    -Create Object BOX

    • Set BOX "instance var" to 1
    • Set BOX x to 0
    • Set BOX tint to "255,255,255"

    I'm assuming it's not possible, but just curious if anyone had a clever way to do it. I'm creating so many objects in my menus so I feel like they should be destroyed everytime you close the menu (and you can't recreate them initially because each menu on each layer shares items, so they get duplicated like crazy).

    Any input is greatly appreciated!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can pick any object after it is created, of course that is possible. If you are destroying the entire menu, why do you need to pick specific objects?

  • - correct, but not if you're creating the object "by name".

    I think I have an easier way to manage it; basically I'm going to create families for all UI object-types, and then recreate EVERYTHING, and immediately after destroy what isn't being used. I'm slightly worried it will cause a hiccup everytime a menu is opened, but I'm not quite sure what else to do.

  • When you create an object by name you are still just creating that object so what you are asking is can you pick that object by its name, or 'reference' it as you worded it in the question and the answer is yes, you can reference objects after they have been created.

    If your menu items are placed in the layout and destroyed on start up then there won't be any jerky loads as they have already been loaded into memory, unless the performance has dropped for other reasons such as large images, particle effects or too many objects being used.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)