• 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 pinwheel · May 19, 2016 at 04:53 AM · robotwrite datacommands

Dynamic Commands, Where do I start looking?

So currently, I have a game object(AI) that, when it collides with another game object(bot) with a certain tag, allows the player to control that bot. When the "push" key is pressed and released, the AI is launched at a 45 degree angle, allowing the player to push his way into controlling another bot.

This is a pretty decent core mechanic on its own, and I like it, but I'm trying to push my limits.

What I want to do next is to have a "loop" key that, when held(for a set period of time to avoid memory congestion and too much player fuggery) writes the inputs into a series of commands that the bot does over and over again.

To be honest, I'm not entirely sure where to look, and I'm going to go ahead and swallow my pride(mmm...tastes like progress) and ask for help before I go down anrabbit hole, and end up burnt out with another half finished product that I don't want to release because of my accursed hybris.

If any of you wise men and women have any suggestions on what could work, what should work, and what absolutely will not work and I should avoid, you would have my gratitude.

Comment
Add comment · Show 2
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 pinwheel · May 19, 2016 at 04:38 AM 0
Share

Looking into bytestreams. It's a possibility that I hadn't considered earlier until reading the post below. Probably should have given myself a better title. Sorry.

http://www.gamasutra.com/blogs/Auston$$anonymous$$ontville/20141105/229437/Implementing_a_replay_system_in_Unity_and_how_Id_do_it_differently_next_time.php

avatar image Mikilo · May 19, 2016 at 09:04 AM 0
Share

Hello,

If I understood your statement, you want to have a looping macro. Holding a special key will start the macro, you do your commands, then you release the special key to end the macro.

Where is the question?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by coolraiman · May 19, 2016 at 02:28 PM

you could make a replay system with a record and play function.

lets say you have a List> commands each byte represent a different input

here is some pseudo code to guide you i made something similar to record the transform of some cars in order to replay the last second of the race in a slow mo

 bool recording = false;
 List<List<byte>> commands;
 
 public IEnumerator record()
 {
     recording = true;
     
     //init commands
     
     while(recording)
     {
         yield return new WaitForEndOfFrame();
         
         if(Input.(the recording input) is false)
         {
             
             recording = false;
             
         }
         else
         {
             
             //init second dimension array
             
             for(every input you have to check)
             {
                 //for each of these input that are pressed, add to the list its byte id
                 
             }
             
         }
         
         
     }
 }
 
 bool replaying = false;
 public IEnumerator replay()
 {
     replaying = true;
     for(int i = 0; i < commands.count; i++)
     {
         for(int j = 0; j < commands[i].count; j++)
         {
             //call the function needed for each input in commands[i] in a switch statement 
             
             yield return null;
             
         }
         
     }
     replaying = false;
 }
 

with that you should be able to make your way

Comment
Add comment · Show 1 · 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 pinwheel · May 19, 2016 at 05:51 PM 0
Share

Thank you so much! I'll run a few tests tonight!

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

How can I make robot fire a machine gun? 1 Answer

Unity Robot - left forearm glitchy transform 0 Answers

Java Script command list 3 Answers

simple write and read variables 1 Answer

Writing data to files issue after update Android SDK platform 0 Answers


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