How do you check if a parent BP is a certain type?
Hi everyone, I am working on object inspection functionality for a mobile game. To set the scenario, the player walks around a room, and touches an object. OnTouch, the GetObjectUnderThumb (or something like that, I'm not at my computer right now) command is called and I get an object from it that the player touched. Now to determine whether or not it should be allowed to be inspected, I need to check if it's parent BP is InspectableObject. (The child BPs might be things like Lamp_BP or Photo_BP) I know that if you have the parent, you can try to cast to the child (the classic "I have an animal, try to cast to a tiger"). But if I have the child and I want to know if the parent is InspectableObject, would i still use casting? Thanks in advance!
asked Nov 16 '18 at 04:48 AM in Blueprint Scripting
yes you would still use the cast, ASSUMING, that the object you are being given, from the function call you are talking about, gives you the bottom (or low enough in the chain) of the parent/child replationships, such that a cast would function.
One other idea that comes to mind, that makes you independent of what the engine gives you in terms of an object. Is that you could have all inspectable objects that you create, have a tag that you could just query, if tag found, it's inspectable, if no tag, then of course not inspectable.
Hope this helps,
answered Nov 16 '18 at 04:55 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here