Multiple object Enable/Disable

(Jukebox Animation) #1

Hi !

I read somewhere Leslie saying that “Blox1 is not good with list of objects”.
So If I just use tags for influencing multiple objects, it won’t act properly.

Is there a way to en/disable a group of objects without listing them all manually in the bloxeditor ?

Also, if that is fixed in the blox3, I don’t know which version I have and whether I can upgrade or not. I just have the one in plygame.

Thanks !

(Alien) #2

The Blox that comes with plygame is the blox you get. there is no upgrade.

blox3 is an independent asset that doesn’t work the same as plyBlox/Blox1. although you can use blox3 with Plygame, it doesn’t behave the same nor does it have any of the RPG, game info you would be accustom to in plygame’s blox.

You can use blox3 to code up some stuff, or leverage the plygame functions and methods, but its completely separate visual editor.

(Jukebox Animation) #3

Thanks for the reply !

Oh …Does that actually means I can use both plyblox and blox3 in the same project without colliding ?

I also wonder it there would be a solution to my problem just using the plyblox then …

(Alien) #4

I didn’t have any issues running both in the same project. There was no conflicts between them. Blox3 was nice, since you could use it to write code with other packages, like leantween or anything else, since blox3 has the namespace lookup, you could reference many other libraries with the blox functionality. That part is not in plyblox.

I cant answer the original question on lists. that part I’m not sure of.

(Leslie Young) #5

What is it you are trying to achieve? plyBlox does not have a List support in its variables but it does have support for lists. The problem is that these lists must be build at run-time. They are normally used where some plyGame/RPG system wants to return a list to Blox so you can do something with it.

To build your own list you could use the List Blocks during a Start event to build the list. For example…


I simply drag-and-drop the GameObjects from the Hierarchy to the Add Block fields.

(Jukebox Animation) #6

Hi Leslie !
Thanks for the reply.
I was trying to achieve a modification (en/disable… animation etc) on a group of objects just by using tags. But it seems to apply the first one it finds instead of modifying all those that have the tags.

So the list, although you have to add each element manually beforehand, seem to be a good solution for that ? I don’t really know what it is used for right now. Could I, for exemple, make a list called 1 in which I put objects A, B, C and put a Block that disable objects “in list 1” ?

(Leslie Young) #7

It depends on what Block you used. Blocks normally only return one object (the first) of whatever you are looking for.

Another option would be to run through the list of child objects of an object; seeing as you say they are “grouped”. A block like the Object > Child Count could be used in a Loop Block to update a counter/ index which you use in Object > Get Child to get a reference to a child object and then you can do whatever you need to, to it. (remember the “one less” option in the Loop Block)


(Jukebox Animation) #8

Thanks a lot for that solution Leslie !

I don’t pecfectly get the logic of the loop with blocks, but I guess I have to group objects under a empty game object for exemple, to apply something to all of the childs (to temp obj as object in your exemple) ?
I’ll try that out thanks !

ps. btw I didn’t know you could get a child object by it’s order, good to know !

(Jukebox Animation) #9

Hi again !

Your method seemed to work, but I had an error :s maybe I did it wrong.

All I did is that I made the exact same blocks as your exemple, and put a disable/enable block inside the loop. The event was triggered by buttons. It worked perfectly once, then when I tried to click the second time on the buttons, nothing happened. And I had this error message :

[Flow/Loop/Loop with] in [2/State 0/1]: Transform child out of bounds
UnityEngine.Debug:LogError(Object, Object)
plyBloxKit.plyBlock:Log(LogType, String) (at D:/Work/u50/SOURCE/plyBlox/plyBlock.cs:149)
plyBloxKit.LoopWith_plyBlock:Run(BlockReturn) (at D:/Work/u50/SOURCE/plyBlox/Blocks/Flow/Looping/LoopWith_plyBlock.cs:87)
plyBloxKit.plyEvent:Run() (at D:/Work/u50/SOURCE/plyBlox/plyEvent.cs:78)
plyBloxKit.plyBlox:RunEvent(plyEvent) (at D:/Work/u50/SOURCE/plyBlox/plyBlox.cs:643)
plyBloxKit.plyBlox:TriggerEvent(String) (at D:/Work/u50/SOURCE/plyBlox/plyBlox.cs:460)

I wonder what I did wrong ?

(Leslie Young) #10

Were the child objects removed? I can’t see why you would get this error if you simply disabled them.

(Jukebox Animation) #11

Nope just disabled, it’s weird …

But anyway, I’m thinking that it’s not really what I was looking for (if I want to disable that group, I just have to disable the parent once XD)

But I’m starting to think about another solution, I’ll get back if I don’t find any !