Cannot freeze Player during conversation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Luseya
Posts: 24
Joined: Mon May 29, 2023 6:02 pm

Cannot freeze Player during conversation

Post by Luseya »

Hello!

To freeze my Player during conversation, I tried following the steps in this video: https://www.youtube.com/watch?v=ZxppOvE ... elCrushers

When I add the script that controls my character movement, it doesn't give me the option to disable it (please see screenshot attached).

I'm new to scripting so I'm not sure if it's something I need to modify in the script.

Thank you so much!
Attachments
PlayerComponentsScreenshot.png
PlayerComponentsScreenshot.png (69 KiB) Viewed 1078 times
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cannot freeze Player during conversation

Post by Tony Li »

Hi,

Short answer: Assign the player GameObject that has your script on it, not the script file in your Project folder. Then you'll be able to select the character movement component's enabled property.

Long answer:
In C#, script files define classes. A class defines a set of data and the operations that can be done on the data. For example, the Unity "MonoBehaviour" class defines some data such as "enabled" and "transform".

The C# language has a feature called inheritance that lets you create new classes that extend the behavior defined in other classes. The original class is called the base class, and the class that extends it is the derived class.

Your character movement class is a derived class of the MonoBehaviour base class. Unity lets you add an instance of any class derived from MonoBehaviour to a GameObject. This instance is called a component.

Make sure to assign components, not script files, to UnityEvents in the inspector. This way Unity knows which instance of the class (e.g., on which GameObject) to work with.
Luseya
Posts: 24
Joined: Mon May 29, 2023 6:02 pm

Re: Cannot freeze Player during conversation

Post by Luseya »

Thank you for your reply!

I totally didn't realize you could just drag components on the Player into that box.

I also realized that my husband had written the code in a way where it couldn't be deactivated, so I will have to work with him on that.

Thank you so much! Your explanation was very clear and helped with my understanding of how all this works. I appreciate it :)
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Cannot freeze Player during conversation

Post by Tony Li »

Glad to help!
Post Reply