playMaker

Author Topic: Find&reference objects in project, not in scene.  (Read 82 times)

nFighter

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 96
    • View Profile
    • multiplayer adult fighting
Find&reference objects in project, not in scene.
« on: August 08, 2018, 07:15:39 AM »
Hey! It looks like a very common task, but i'm not sure how to do it right.

I have some objects in a /Assets/Resource folder. All objects have Array List proxy with data. How should I found the certain object by name and read data from it?

Is there something like Find Game Object, but for searching in the project, not the scene?
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3241
    • View Profile
    • jinxtergames
Re: Find&reference objects in project, not in scene.
« Reply #1 on: August 08, 2018, 07:02:45 PM »
Hi.
I don't think that it is possible to find the game object if it is not in the scene.

But a way you could do this is to have an array with the prefab names, and then instantiate the object.

Do these object only have an array list component or do they have more components?

If only the array list, then it is maybe better to have them in your scene and you can enable/disable them if needed.

nFighter

  • Beta Group
  • Junior Playmaker
  • *
  • Posts: 96
    • View Profile
    • multiplayer adult fighting
Re: Find&reference objects in project, not in scene.
« Reply #2 on: August 09, 2018, 08:25:24 AM »
Actually, it's possible with the Unity's Resource management, but maybe it's not a best way  ;D

Actually, it's a "kind of" inventory implementation. It's an icons objects with simple scripts and array lists with details. And for now I'm doing exactly as you say - just keep them all in scene.
indie developer of multiplayer adult fighting
http://nakedfighter3d.com