Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: MakerPlay on August 11, 2017, 07:31:02 AM
-
I need a modified "TriggerEvent.cs" which is able to let me choose my target GameObject. Now i am only able to put the FSM onto an object which has a RigidBody or a Collider Component.
This is really anoying, because i have always to take a look, into my hierarchy and it makes my "overview" of the Playmaker States terrible. So please, if anyone can modify the script to got a option to choose your target GameObject, it would be awesome ! Thanks ...
-
Hi,
as far as i know this is not possible, it is a unity limitation.
If you would use standard scripts you would need to place them on the object that needs to use a trigger.
What i use regularly is : an fsm on the object with a trigger event' action and then in the next state use a 'send event' action to send a event to a different fsm
Here is a video tutorial about global events and transitions :
-
Hi,
i have updated the action 'Trigger Event 2' on the ecosystem (https://hutonggames.fogbugz.com/default.asp?W1181)
with this one you can target a send event, so you can do what i said on my last post with a single action in a single state.
-
Hey,
thank you very much for invest and the respond ! Glad if it works. Will try i later when i am back home.
As you said, it is not possible. I am not sure, because i have other visualScript tools where this behaviour is possible. Therefore i thought it should be possible with Playmaker as well.
-
Hi,
which tool is that?
I would love to see how they managed to do so.
Maybe there is a way then to implement it in Playmaker also.
-
I use these tools in combo with PM:
- FlowCanvas
- NodeCanvas
- GameFlow
All these have the ability to use ANY object as a target object. I wrote this month ago in the forum:
I have to say, it is a very important function to have something on board, to change the target object. Especially on the trigger event. Because i want to have a nice structure in my Program stack. Otherwise i have to search it in my 2000 Objects in the hierarchy where my trigger FSM is on.
So, please someone add a function to the trigger event, where i can put my desired target object.
-
Why do we need that in PM ?
Well, in my opinion it is really important for a good workflow. As described, if you go the standard way, you lose your nice "structure" in the hierarchy. You have to "search" your spreaded FSMs on different objects, really anoying. Sure you can use "sendEvents", but it isn´t an elegant way. And it is not only for the "TriggerEvent". There are some other Actions, that don´t have the ability to select your TargetObject.
-
Hi,
From what i can see in the few videos available on nodeCavas and on GameFlow
the trigger events are also on the trigger object and also using Tags
On game flow (https://www.youtube.com/watch?v=cCSEzS9dz_0&t) you need to drag 'other' in Tag/Of
Other is a result of what entered the trigger and then it will check the tag if it is equal.
Also nodecavas (https://www.youtube.com/watch?v=hYLf45-PQpM&t=104s) works the same.
What actions do you mean that don't have the ability to select your TargetObjects?
-
In GameFlow for instance, you don´t need to make any Tags / Layers to your desired Objects. Simply Put the TargetObject into the Slot. Thats it !!! It is really a dream :-) (its n old video. You don´t need to put it on the active object)
I don´t know how it internaly works. But you as the user, don´t have to hassle with anything. Just put all things together, and it works perfectly. It is a enourmusly benefit for the whole workflow / speed.
Not only TriggerEvents in PM are working this old-fashion way. Also CollisionEvents. And many others don´t have the ability to select the TargetObject as above described. Sadly ! Many new / other VisualScripts have the ability to put events on any objects (for a nice structure) and you can put also as many objects as you want into the slot of the TargetObject.
-
Hi,
Can you reference a new video?
or make a video showing this?
I think i can make something similar,
from what you explain (under the hood) the trigger gets the object and compares the object(s) you inserted
But the action still needs to be on the trigger object.
If you can show me how GameFlow uses trigger source from another object
maybe i can find out how to do it.
-
You don´t believe me, huh :D
I am not a Unity-Tech to know this restriction "...action still needs to be on a trigger object". Sounds a bit lame, to be honest, from the unity-side. Somehow the Devs of these other VS´s get it working.
I will try to make some Pics, maybe videos. So you will see, that it works flawlessly. I am not sure, if i can show how it uses trigger-source from another object (i guess everything is under the hood).
-
This is how it works:
(http://hutonggames.com/playmakerforum/index.php?action=dlattach;topic=15600.0;attach=11402)
Can you get the idea of it ?
-
Hi,
I believe you :D
i just could not find any sample/video that shows this (for research purpose) :)
It is indeed lame from unity that it has to be on a trigger/collider object...
This unity answer is explaining that you can't trigger directly from another object
http://answers.unity3d.com/questions/867859/how-to-detect-ontriggerenter-on-another-gameobject.html
When you play the game, does it add some component on the source object from the trigger? (the "in GameObject")
I think it is doing so and that makes me wonder performance wise especially when instantiating (creating) new object with triggers while playing the game.
I can let you in on a secret that PlayMaker is investigating this.
(This does not mean that it will become available.
But if it is possible without performance loss, there is i chance that it will be included in a next update.)
-
I am not sure if this is an unity employee :D ...If it is, it seems he doesn´t have many understandings of how internal stuff works.
Again, you don´t believe me ;D . Nothing is added during the play. C´mon man ;) . (just kidding around) So performance is: top ! Everything works as it should. I know, it sounds like magic. Maybe it is. Or unity has internal many secrets.
You really think, PM is doing something ? I am a long time user of PM. Don´t missunderstand me, i love PM, because of those many actions it has. But after 4 years NOTHING changed UI wise, workflow wise. Main TargetGroup of PM, are non coders, designers. Therefore it is really important to improve Ui & workflow time by time. Not only updating some actions (community is allready doing this).
This is why i also trying and buying other VS´s systems. For me, there are many lacks that should be improved. So, if it is true, what you are saying, i buy PM again. But hard do believe. Enough trash-talk. PM is the 1st tool, how i get in touch with unity ! Therefore i am loyal to it.
So if you, or anyone else is willing / has time to modd the "TriggerEvent.cs", it would be great. Otherwise i have to wait, or use other tools. Thx you very much, for explaining some things, investigating your time :)
-
Hi, I will also chime in here. I also researched this problem lately, as I was writing custom playmaker actions for ragdoll (which also uses collision events). Unfortunately as djaydino mentioned, you do need to have the trigger events on the actual game objects currently.
Basically the only way around it is to have a second script listening for the event to happen.
Honestly this sucks. Its too bad Unity designed it this way. :'( :'( :'(
You can see replies about it here:
http://answers.unity3d.com/questions/486214/ontriggerenter-on-seperate-object-than-the-script.html
http://answers.unity3d.com/questions/986235/is-it-possible-to-check-collision-from-another-obj.html
http://answers.unity3d.com/questions/40434/ontriggerenter-through-a-different-object.html
The easiest playmaker way to handle that at the moment, is to have a global send event. Your right, its not elegant, but is essentially what these examples above are doing (but just with script).
-
Hey, thx for jumping in.
It looks like, there is no way around. Some of these examples show also "AddComponent" which isn´t that good, performancewise. Global sendEvent requires a second script, and so on...So i have to say, the other VS´s get it working, somehow. Believe me, or not, it can´t be only magic, there is more :D .
-
Can you open one of those actions and send the code to me or djaydino?
-
@tcmeric
What actions are you asking?
I only own playmaker :)
-
I guess it is meant: something like "TriggerEvent.cs" but in GameFlow or in FlowCanvas, right? So you can take a look, how they managed to get it work.
I will take a search, and if i find something like that in GF and FC i will post it.
-
this is the code of "TriggerEvents.cs" inside FlowCanvas:
using NodeCanvas.Framework;
using ParadoxNotion.Design;
using UnityEngine;
namespace FlowCanvas.Nodes{
[Name("Trigger")]
[Category("Events/Object")]
[Description("Called when Trigger based event happen on target")]
public class TriggerEvents : EventNode<Collider> {
private GameObject other;
private FlowOutput enter;
private FlowOutput stay;
private FlowOutput exit;
protected override string[] GetTargetMessageEvents(){
return new string[]{ "OnTriggerEnter", "OnTriggerStay", "OnTriggerExit" };
}
protected override void RegisterPorts(){
enter = AddFlowOutput("Enter");
stay = AddFlowOutput("Stay");
exit = AddFlowOutput("Exit");
AddValueOutput<GameObject>("Other", ()=> { return other; });
}
void OnTriggerEnter(Collider other){
this.other = other.gameObject;
enter.Call(new Flow(1));
}
void OnTriggerStay(Collider other){
this.other = other.gameObject;
stay.Call(new Flow(1));
}
void OnTriggerExit(Collider other){
this.other = other.gameObject;
exit.Call(new Flow(1));
}
}
}
GameFlow is closed. This means, all actions are inside a *.dll. So i can´t share with you.
-
I did some investigation and GameFlow is adding components to forward MonoBehaviour events (MouseDown, Collisions etc.) to scripts on other objects. They just add these components automatically and hide them in the Inspector. So behind the scenes, you're still doing Add Component etc. You just don't need to worry about setting it up. I'm sure other VS systems are doing the same thing - it's really the only way to get these MonoBehaviour events (AFAIK).
I've been playing around with adding this feature to TriggerEvent, CollisionEvent etc. and hope to have it in the next update. We already do a lot of pre-processing at build time to avoid un-needed Monobehaviour event overhead and Add Component costs at runtime, so we should be able to expand that system to handle events on other GameObjects while minimizing performance costs.
-
You are really sure, it is working this way (add comp.)in GF ? I don´t know if this is the right way, doing it in PM, because of performance. But on the other hand, i have to say, a clean structure is the most important thing in a big project, using a VS system. Otherwise the overview get broken, get spaghetti and so on.
-
Ah yes, i forgot about 'hide in inspector'
gameObject.GetComponent<Myscript>().hideFlags = HideFlags.HideInInspector;
That would indeed explain every thing
I don´t know if this is the right way, doing it in PM, because of performance.
I don't think that this way is going the have performance issue if it is pre-processed.
If there where Tons of triggers it might increase loading time.
But on the other hand, i have to say, a clean structure is the most important thing in a big project, using a VS system.
I must disagree with you, performance is the most important in almost any project.
i definitely would not like to have lag in my games :)
-
Hi,
I confirm as well that there are no other ways to catch trigger events than having a monobehaviour on the GameObject itself acting as a proxy if you whish other GameObjects scripts to be aware of his.
I think it roots from the way GO, components and monobehaviours where designed initially in Unity.
Bye,
Jean
-
Thx for explaination. Interesting. I think this core-behavior in unity will not change in the future. If its doable with "proxies" somehow, why not. Seems like other Devs. doing it this way.
True, performance is important. Just thought that clean code / structure results in a good performance. Otherwise you got bad performance. On top, it depends on the gameEngine too i think.
-
Hi,
The current beta of PlayMaker is currently focusing on this, early tests are positive, so this will be available soon, you'll be able to select a gameobject target for triggers and colliders actions.
Bye,
Jean
-
Hey,
nice to hear that. Will be curious how the workflow will be. Is it planed to be, lets say, in the next release 1.8.6 ?
One last thing:
please add "multi object targets" into it. So usually you are able to put only "ONE" object into the target-slot. This is also a big downside. Please update this to be able to put as many target-objects as you want into the event. Thanks !!!
-
Hi,
PlayMaker is already at 1.8.6, so it will be in 1.8.7
Multi object targets is not planned in any actions, so I don't think it will be available no.
Bye,
Jean
-
Hi,
But there might come a custom action for it when possible ;)
-
Yeah, I think the infrastructure coming in the next update will make it easier to do things like events from multiple objects.
-
Very cool 8)
This is what i wanted to hear. Possible custom-actions, new infrastructure and TargetObjects for events. Nice bright future :)
-
BUMP
Sorry but I need help with an ALTERNATIVE for Trigger Stay!
When you put a Trigger enter event it lets you store the results in a "GameObject Variable" How do I use this with BOOLS ?
What is the best alternative for Trigger Stay ? Thank You so much :)
-
Hi,
You can use "get Fsm bool" to get the bool value from that fsm on another fsm
Then you can use a bool test to see if true or false,
then you can for example use a send event to do something
-
The latest update includes target objects for collision and trigger actions.
Please give them a go and let us know how they work for you!
-
Very Cool. You mean the new 1.8.6 Version ?
As i know, in v. 1.8.5 you have two versions. One for Unity 4 and another one for Unity 5. It seems in v. 1.8.6 there are some for Unity 5 and Unity 2017. Am i missing somewhere Unity 4 ? Or will there not be anymore Unity 4 versions included ?
-
Yes, in Playmaker 1.8.6.
Newer versions of Playmaker (1.8.6+) now need Unity 5.3+
We'll probably raise this to 5.6 soon since Unity is not patching older versions to fix issues with macOS 10.13 (High Sierra):
https://forum.unity.com/threads/unity-and-macos-10-13-high-sierra.474527/
-
Ah ok. Good to know. Thx for clarification !