• 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 YoYo89 · Dec 23, 2014 at 06:52 PM · doorstate-machinefsmwhats-wrong

State-Machine Based Door entity

Hello Everyone,

I'm hoping to get t$$anonymous$$s state-mac$$anonymous$$ne based door working today as I've been stuck on it for the past few days and can't seem to get it to ever call it's autoshut method and close automatically after a given delay when the player has exited its trigger volume. I'd really like to finish it off today (at least the base functionality) but can't get over t$$anonymous$$s hurdle, can anyone spot what I'm doing wrong or missing?

FSM Door Entity v.1

I'm also t$$anonymous$$nking t$$anonymous$$s would be a cool addition to the script wiki if I can get it going. I hope someone spots t$$anonymous$$s as I'm really wondering what I'm doing wrong here. Thanks again for your time and have an awesome holiday!

UPDATE Here is the current iteration of the FSM Door class, I'll keep t$$anonymous$$s link changing from now on, thanks folks!

FSM Door Entity v.2

What it's doing now it acting a little more stable, it's playing its correct animations and switc$$anonymous$$ng states properly but doesn't seem to want to follow through with the AutoClose method. I'm probably looking at t$$anonymous$$s a bit too long, so I'll put it down for today and opt to work on some other areas.

Comment
Add comment · Show 3
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 Mmmpies · Dec 23, 2014 at 08:43 PM 0
Share

Well that's a lot of scripting!

Too much for me to get my head around easily.

Can you Debug.Log the thing to death. Well just the bit's that apply to closing the door. Record Time.time and which parts are being activated where and what time the door should close.

Let's see if we can spot where it's going wrong.

avatar image YoYo89 · Dec 23, 2014 at 08:57 PM 0
Share

Sure Thing! Just as a heads up anything related to keys can safely be ignored for now =). That will be a whole new hurdle lol. I'll edit this comment (and up top) when I get the Debugs all set up. ( I've been toying with the script since my last post as well).

avatar image jmgek · Dec 23, 2014 at 09:28 PM 0
Share

This won't answer your question but a little advice if you want to take it. Even though your code looks amazing and it is properly done and you are using best practices I would suggest hacking it out first to get it to work properly then optimize and make it look beautiful. With all due respect this is a door code if it takes you 10 hours to write a simple code that could be written in 7 lines you are wasting time on trying to perfect something that can always be done later. But again it looks amazing! but if it does not work it's useless...

A little side note, you should be making a system that can handle any argument so you are not just using this script on one thing. An example is when I was making my door scripts to allow the player to move throughout the map it was pulled from my pick up system where I would pass out a function when something was true and it would either open a door or activate an item or do another function. This was a manager that my team loved because all they had to do was drag and drop the true event into the argument and you saved a ton of time. This can be used for anything, doors, chests, items, enemies, dialoge, etc.

 //EventScript 
 if(conditionTrue)
 {
     getcomponent<trueConditionScript>(); //Place Script in heiracry
     getcomponent.trueconditionScriptBool == true;
 }
 
 //Condition script
 if(trueconditionScriptBool)
 {
     OpenDoorFunmction();
 }

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Multiple animators use the same controller / sate-machine or how to sync them? 2 Answers

Using Playmaker for a game-scope FSM 0 Answers

really weird problem, Enum refusing to change state. 1 Answer

A finite state machine for game objects 0 Answers

Door is glitching open and close 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