playMaker

Author Topic: Switch based on GameObject variable type.  (Read 1357 times)

Matthias

  • Playmaker Newbie
  • *
  • Posts: 2
Switch based on GameObject variable type.
« on: February 23, 2016, 02:32:17 PM »
I have ,,Screen pick" which store variable of GameObject which I am looking at. It is GameObject type of variable.

Q1 : How to make a switch to recognize at what GameObject I am looking at?
Q2 : How to make a logic test ,,If GameObject name is, then..."

Chizzler

  • Junior Playmaker
  • **
  • Posts: 67
Re: Switch based on GameObject variable type.
« Reply #1 on: February 23, 2016, 03:15:04 PM »
There's a field in the Screen Pick action to store the hit game object as a variable.

From there, you could do a "Compare Game Object" with your stored variable, against another variable or object.

OR you could do a "Compare Game Object Tag" If you wanted to see if it was an object of a certain type (that you'd tagged as such)

OR If you wanted it's name, you'd use "Get Name" on the stored variable, and store it as a string variable. Then use "String compare".

Matthias

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Switch based on GameObject variable type.
« Reply #2 on: February 23, 2016, 03:33:45 PM »
Yea thanks , I just had somehow stuck idea that I need to check variable with variable but it is actually easier because I can take directly GameObject. I cant use Tags because I have compare tag already in previous check.

Simple GameObject Compare is what I needed , thanks once more.