Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 AncorG1985 · Aug 30, 2020 at 07:47 PM · gameobjecttriggerfreezeinteraction

Game stops for a few seconds after interacting with an object

Hi there, im trying to establish a system for object interaction, but every time player goes inside the trigger and i press "E" the game stops for a few seconds and then the UI dialog appears, this only appens the first time i try to do this. I would really appreciate any coments on this. I place this script into the object: using UnityEngine; using System.Collections; using UnityEngine.UI;

 public class Object_Interaction_Dialog : MonoBehaviour
 {
     public string[] _Dialog_Database;
     public int _Speech_Number = 0;
    
     public Text _Dialog;
     public GameObject _Dialog_Box;
     public ThirdPersonMovement _ThirdPersonMovement_Script;
    
     public void Dialog_With_Gate()
     {
 
         if (_Speech_Number < _Dialog_Database.Length)
         {
             _Dialog.text = _Dialog_Database[_Speech_Number];
         }
         else
         {
             _Dialog.text = "";
             _Speech_Number = 0;
             _Dialog_Box.SetActive(false);
             _ThirdPersonMovement_Script.enabled = true;
         }
 
         _Speech_Number++;
 
     }
     public bool inTrigger;
 
     void OnTriggerEnter(Collider other)
     {
         inTrigger = true;
     }
 
     void OnTriggerExit(Collider other)
     {
         inTrigger = false;
     }
 
     void Update()
     {
         if (inTrigger)
         {
             if (Input.GetKeyDown(KeyCode.E))
             {
                 _ThirdPersonMovement_Script._Horizontal = 0;
                 _ThirdPersonMovement_Script._Vertical = 0;
                 _ThirdPersonMovement_Script.enabled = false;
                 _Dialog_Box.SetActive(true);
                 Dialog_With_Gate();
             }
         }
     }
 
    
 }

alt text

alt text

objectsettings.jpg (288.9 kB)
backroundanddialogsettings.jpg (187.2 kB)
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 ShadyProductions · Aug 30, 2020 at 07:54 PM 1
Share

Look in your profiler and check what takes most CPU when you interact with the object. It's impossible to analyze otherwise.

avatar image AncorG1985 ShadyProductions · Aug 30, 2020 at 08:34 PM 0
Share

I did, thanks. I think the dialog text has an issue appearing for the first time, in other words unity has problems showing the dialog text, it gets stuck for a few seconds and then it appears.

1 Reply

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

Answer by AncorG1985 · Aug 31, 2020 at 02:40 AM

The Issue was with the Font itself, i had no font added inside my project. Arial is the default font in unity and that was causing the trouble. I hope this is useful to somebody in the future.

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

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

227 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 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 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

Ai trigger 0 Answers

Simple "E" to interact script... 1 Answer

How I can do to make the objects do not take a lot of space in the game? 3 Answers

What would you do with essential items? 1 Answer

Delete certain gameobject if it enters the area. 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