disabling or enabling a public component

I need to be able to disable only a specific component of an object publicly. I got a public component but I cant find any ways on the internet on how to disable and enable that component. Here’s the code:

    public Component script;     void Start()     {     }     void Awake()     {         if (sliderchanged.drop == 1)         {             script.enabled = false; //this is the error         }         if (sliderchanged.drop == 0)         {          }     }     // Update is called once per frame     void Update()     {              } 

How can I get the Text component from TextMeshPro ? I’m getting null exception

At the top of the screen :

public GameObject uiSceneText; private TextMeshPro textMeshPro; 

Then in the script at some point :

uiSceneText.SetActive(true);  if (textMeshPro.text != "")     textMeshPro.text = ""; 

The exception error null is on the textMeshPro on the line :

if (textMeshPro.text != "") 

textMeshPro is null.

This screenshot shows the TextMeshPro in the Hierarchy :


and I see that the Scene Image object and its child Scene Text both are enabled true.

I want to get the text and add replace a new text with the text already in the Text but the textMeshPro is null.

The complete script :

using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine;  public class PlayerSpaceshipAreaColliding : MonoBehaviour {     public float rotationSpeed;     public float movingSpeed;     public float secondsToRotate;     public GameObject uiSceneText;      private float timeElapsed = 0;     private float lerpDuration = 3;     private float startValue = 1;     private float endValue = 0;     private float valueToLerp = 0;     private Animator playerAnimator;     private bool exitSpaceShipSurroundingArea = false;     private bool slowd = true;     private TextMeshPro textMeshPro;      // Start is called before the first frame update     void Start()     {         textMeshPro = uiSceneText.GetComponent<TextMeshPro>();          playerAnimator = GetComponent<Animator>();     }      // Update is called once per frame     void Update()     {         if (exitSpaceShipSurroundingArea)         {             if (slowd)                 SlowDown();              if (playerAnimator.GetFloat("Forward") == 0)             {                 slowd = false;                  LockController.PlayerLockState(false);                  uiSceneText.SetActive(true);                  if (textMeshPro.text != "")                     textMeshPro.text = "";                  textMeshPro.text = "Here I will add the new text.";                              }              if (slowd == false)             {                              }         }     }      private void OnTriggerEnter(Collider other)     {         if (other.name == "CrashLandedShipUpDown")         {             exitSpaceShipSurroundingArea = false;             Debug.Log("Entered Spaceship Area !");         }     }      private void OnTriggerExit(Collider other)     {         if (other.name == "CrashLandedShipUpDown")         {             exitSpaceShipSurroundingArea = true;             Debug.Log("Exited Spaceship Area !");         }     }      private void SlowDown()     {         if (timeElapsed < lerpDuration)         {             valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);             playerAnimator.SetFloat("Forward", valueToLerp);             timeElapsed += Time.deltaTime;         }          playerAnimator.SetFloat("Forward", valueToLerp);         valueToLerp = 0;     } } 

Can Magic Mouth be used to speak the verbal component of a spell?

Could a wizard use the magic mouth ritual on an item, telling it to repeat the Verbal Component of a specific spell when the wizard touches said item, thus allowing a wizard to cast a Verbal spell without speaking? I realise that this would only ever be situationally useful, but I’m just curious to see if I am interpreting the rules on both the Magic Mouth ritual and verbal components correctly.

Is the star chart a material component for the Guidance and Guiding Bolt spells from the Circle of Stars druid’s Star Map feature?

The Circle of Stars druid’s Star Map feature grants the following benefits (TCoE, p. 38):

You’ve created a star chart as part of your heavenly studies. It is a Tiny object and can serve as a spellcasting focus for your druid spells. You determine its form by rolling on the Star Map table or by choosing one.

While holding this map, you have these benefits:

  • You know the guidance cantrip.
  • You have the guiding bolt spell prepared. It counts as a druid spell for you, and it doesn’t count against the number of spells you can have prepared.
  • You can cast guiding bolt without expending a spell slot. You can do so a number of times equal to your proficiency bonus, and you regain all expended uses when you finish a long rest.

Neither guiding bolt nor guidance have a material component. It would seem from the language that RAW one must hold the chart in one hand and cast these spells with the other, unless one has the War Caster feat.

Is my interpretation of the rules correct? And what is actually intended?

Is the star chart a material component for guidance and guiding bolt?

Do NPC spellcasters need a component pouch or an arcane focus?

By D&D 5e RAW, is it possible for the BBEG (or any NPC) to cast spells without needing material components? Alternatively, is there any powerful magic item (e.g. a ring or pendant) in the rulebooks that can allow its wielder to cast spells without needing a component pouch or an arcane focus?

In other words, is there any way I can repeal the following rule?

Casting some spells requires particular objects, specified in parentheses in the component entry. A character can use a component pouch or a spellcasting focus (found in chapter 5) in place of the components specified for a spell. … A spellcaster must have a hand free to access a spell’s material components—or to hold a spellcasting focus—but it can be the same hand that he or she uses to perform somatic components. (PHB p. 203)

Does a wizard need to hold a component pouch or focus in one hand in order for it to work?

One of my PCs is a (weird) wizard who is frequently switching quickly between items—one turn he’s wielding a quarterstaff two-handed, the next he’s got a component pouch and a dagger, and after that, he’s going back to the two-handed quarterstaff to prepare for an attack of opportunity.

We often find ourselves in situations where we’re not sure if the rules on action economy actually allow for him to cast some of these spells. For clarification, this question is two-fold:

  • If a focus is merely worn, can a wizard still cast his spells?
  • If it fits, can the wizard hold a component or focus in the same hand that performs somatic components?

Can I cast spells that require a material component and still hold my hammer and shield?

I have a human cleric (war domain) with the War Caster feat. She holds a warhammer and a shield. Am I able to cast spells that require a material component and still hold my hammer and shield?

If not, then what are my options for casting a spell that requires material components? Do I drop the shield or warhammer? Does it cost a free action, move action, etc.?

How to “modify” MediaPlaceholder / a React component?

Pardon the slightly naive question, but I’m still working on my first block, and am new to both Gutenberg and React. For lots of reasons ([hopefully] simplicity, reusability, extensibility, etc…), I’m trying to use existing stuff wherever possible. In this particular case, I’m trying to use MediaPlaceholder, but I need to make a couple of modifications:

  • I want to specify the directory that’s used, both for "upload" and for "media library"
  • I want to change the link text for "Media Library" to something else
  • I want to add a fourth option (beyond "Upload", "Media Library", and "Insert from URL")

I don’t want to do the above everywhere that MediaPlaceholder is called; only in my new plugin’s block.

The doc’s have a hook for a filter to "replace or extend" it, but I can’t find any examples of someone doing this; and, based on similar filters in other parts of the block editor, it seems like it’s mostly for "extend", and "replace" would be a PITA. Another possibility is to set the disableMediaButtons prop, and add a child with my own buttons — but that seems like it would involve a ton of repetitive code. I also looked at React’s concept of "composition", which might be what I need, but if it is, I need a much better tutorial.

Am I thinking about this the right way? If I want a "placeholder" that lets someone upload files to a specific location, or point to a URL, or do something else (the specific something else is schedule a cron job, but I don’t think that detail matters), am I best off starting with MediaPlaceholder? And, if so, what’s the Right Way to go about modifying it to do this?

Does the material component of Booming blade need to the same one used in the attack?

Does the spell specify that the material component need be the same as the one used in the attack?

As part of recent errata to the green-flame blade and booming blade cantrips, their material components have been amended to "a melee weapon worth at least 1 sp" (Sword Coast Adventurer’s Guide, 142).

If not then can you use a separate sword for the component?

Does an artificer require two hands to cast spells with a costly material component?

An artificer must use an appropriate spellcasting focus when casting artificer spells. And they must use costly material components when applicable. Neither can replace the other.

But can they handle their focus and costly material components with the same hand? I know of spells that contain more than one material component, such as Simulacrum involving both snow and powdered rubies. I am not sure whether that applies when there is both a focus and a material component in use.

Does an artificer require two hands to cast spells with a costly material component?