Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Willfree · May 28, 2018 at 10:21 AM · script.eventsystemcomparison

Event system vs separated scripts

Hello, I am working on a game with a lot of events like dialogs, objects comparison and door opening. I was wondering what is the best thing to do between writing an Event System (An NPC will have actions to do one after the other) or add a new script to each NPC with it's own actions.

What really blocks me is that if is use the event system, some NPCs may have some unique actions (like an animation or a script) only used by them and i won't add it to the event system. So is it better to only use scripts or write the event system (Which is not really a problem, Odin is even better to make it work)

Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by GameGuy · May 28, 2018 at 11:50 AM

I guess there is no "right answer" here, it really depends on project size, game type, skill of team and so on... When you have a good scope of what the game mechanics will be and good documentation is also no big deal you can combine both worlds and use their advantges. Create basic Event systems and do the fancy stuff modular on per script base.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Willfree · May 28, 2018 at 03:45 PM

I see.. so Event system for basic and common actions and scripts for complex events.

Actually, i work alone on a project which requires a lot of events. I've made a working event system. It's just something i needed to know before implementing something that won't be optimized or useless.

Thank you for your answer.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShadyProductions · May 28, 2018 at 04:00 PM 1
Share

You can always make a base class which inherits monobehaviour, and build some basic behaviour to handle events in a generic way. You can then use that baseclass as a base for all your events which will make life easier. This is an option to do it script by script. (depending if u inherit from monobehaviour or not).

avatar image Willfree ShadyProductions · May 29, 2018 at 12:27 AM 0
Share

What i did is create the Event System with a base class and inside it has many other classes which are actions done one after the other. So i added one which calls a script.

$$anonymous$$y Base Event class contains a class called "Action" and a list which stores these actions. Each action have an enum with every type possible (show a dialog, manage the items, compare a value) and the player or the reader will loop in the actions list.

The action class also have it's own classes, one for each type to set different values every time.

(Also, i am using Odin to make it work better)

alt text

alt text

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

91 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

UI Button : Previously working but now it's not working 0 Answers

How can i add a event onclick for a ui button that is child of canvas ? 1 Answer

Importing Post Processing Stack didn't clear the errors 0 Answers

Advice on reducing amount of direct referencing. 0 Answers

Add Button Script to 3D gameObject 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges