Add behaviours to prefabs

I want to add behaviors to my prefabs so I can deactivate them whenever is needed, as for the moment it is imposible to target a specific child of a prefab with events, but even if it was posible, this will always be convenient.

Can you explain further? You can assign behaviors to the prefab object and to the prefab children. The only issue from my testing is prefab children behaviors can only interact with other prefab children. The prefab behavior applies to the object as a whole.

You can also create functions that apply to child objects.

you can add behaviors to a prefab but not on the prefab editor, only on the scene. On the prefab Editor you can only add beahviors to individual children, but you canā€™t interact with the children of a Prefab outside the prefab editor.

you can apply functions in the object event sheet but a lot of times it comes handy to anulate a bunch of functions by simply disabling the behaviour that contains them.

I have another feature request regarding the posibility to interact with the childs but this is just about being able to add behaviors to the object that for the momment holds the hit box of the prefab, which is something that will be useful even if the other feature is added.

My Ideal settup is this:

1-A gameCharacterPrefab (I need both features added for this one) for a game that has many playable characters with diferent behaviors and AI, all of the variations are childs of this object;
-The main object runs the creation of its variations, the main hitbox, the variables, the player -ownership on multiplayer and such things.The childs define the size of the hitbox and "artificial inteligence(things like the specific fighting patterns of a character on a fighting game.
This game character Idiealy should be able to directly be imported to any game, with all of its variants, that could inlude all the npcs of a game as well as their 3D models or sprites or whatever.

2-a UIPrtefab (I already have this one)
this object runs all the UI of the game, creates menus, text entries customizable mulktitouch input, storage actions, etc, on the spot without using external layouts.

3-hitBoxPrefab (both features needed for this)
this object runs the creation and lifecycle of things that affect gameCharacters(like:
-fire with behaviors that simulate fire and changes the state of other objects made to interact with it, ā€œburns themā€.
-custom projectiles
-items that run their events on their own only when they exist on the scene.
etc.

4-aSceneryPrefab(this one also needs bothe features)
a prefab that creates the world, Āæyou want to create your own tile map system instide this object to run complicated stuf like event based terrain generation/modification? Āæwhy not? Āæwant to give ownership of this object to a player and turn them into remote dungeon master for your online tabletop with 3D animations VR implementation? ĀæWant to let players save their custom level layouts and share them? This object can run your game like a scene, with the difference that you can summon it on any scene you want, Āæhave you ever wondered how do I change a scene after the lobby game started, or, How do I have players on the same lobby interact with diferent scenes at the same time? this is one answer to that question.

A lot of feature requests and comonly asked questions are solved by adding these two features, specially the ones related to the built in multiplayerā€¦

1 Like

Possibly unrelated but I noticed they added the visual editor. A lot to explore.

1 Like

It is unrelated but also very cool

1 Like

it is actually related to the sceneryPrefab and the UIPrefab, Iā€™m in love, I was placing my stuff with coordinates and functions, and assigning sprites on the scene editor

This is not supposed to be shown. Please, donā€™t use it as compatibility wonā€™t be ensured on this experimental feature.

Thank you for reporting the issue. It will be hidden back in the next release.

1 Like

I canā€™t wait for it to be officially released. Thereā€™s a lot of potential. Itā€™s like a scene within a scene like one of those infinity mirrors.

1 Like

Yes, but for modular programing

Ok Iā€™ll keep doing coordinatiesā€¦ It was cool, never knew I needed it until I saw it, as I said it makes two of the prefabs I want to make faster to setup

1 Like

But itā€™s so perfect :heart_eyes::sob:, plis donā€™t take the precious

I was following this and the other thread u made about custom objects.
Iā€™m just curious since iā€™ve still not tested the function since iā€™m at 5.3.,(and iā€™m thinking to upgrade bcs that), but, i remember to have used unity a bit in old times and there are various kinds of controllers that can be used as premade system for a gameā€¦like first, third person controller eccā€¦ eccā€¦where u just need to load your 3d model to make everything work with 0 effortā€¦and i loved emā€¦then i tried the corgi engine (guess it is famous) for 2D.
While i understand the usefulness of prefabs, prefabā€™s behaviour eccā€¦, and custom objects in 3D, can someone explain to me how it would fit in a 2d game, where u need to create any sprite differential from scratch?..i mean what does it change from the custom behaviour system or external event system we have rite nowā€¦for the 2D sideā€¦(where iā€™m interested the most)

Iā€™m not criticizing, just asking for my personal knowledgeā€¦
I consider your request mandatory for a 3D game

I guess, It should allow to:

  • Make simple pieces of UI, for instance a yes/no dialog
  • Make cards that shows stats like life, attack powerā€¦
  • Make objects with moving parts, for instance a tank

More generally, things that hold together as a whole.

2 Likes

That is somethin iā€™m really interested in.

Even if i find it already pretty easy to do, maybe it will be useful for simplify things in complex projects.

Thx as usual for the explanation.

I donā€™t think I understood the question

No problem.
Davy answered perfectly on what i was asking.

1 Like