Everytime object a is selected = do something

Everytime object a is selected = do something

gibzie90
Participant Participant
684 Views
1 Reply
Message 1 of 2

Everytime object a is selected = do something

gibzie90
Participant
Participant

I need a piece of code to run every time object a is selected. But I'm unsure how to do it.

 

For example -

If obj_a is selected then print "selected"

 

I'm experimenting with -

If selection[1].name == "obj_a" then print "selected"

But that only works once, if I deselect then reselect I don't get the print again.

 

I feel like this should be simple but I can't find anything that I can use on Google.

 

 

0 Likes
Accepted solutions (1)
685 Views
1 Reply
Reply (1)
Message 2 of 2

gibzie90
Participant
Participant
Accepted solution
Just stumbled onto the answer...

Use "when"
Eg:
When select $obj_a changes do
(
If $obj_a.isSelected then print "selected"
Else print "deselected"
)
0 Likes