# Shader.SetGlobalVariable vs CommandBuffer.SetGlobalVariable?

**URL:** https://discussions.unity.com/t/shader-setglobalvariable-vs-commandbuffer-setglobalvariable/658666
**Category:** Shaders & Materials
**Tags:** Shaders
**Created:** [March 18, 2017, 4:52am UTC](https://discussions.unity.com/t/shader-setglobalvariable-vs-commandbuffer-setglobalvariable/658666 "2017-03-18T04:52:41Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![OzzyHont](https://avatars.discourse-cdn.com/v4/letter/o/b19c9b/32.png) [@OzzyHont](https://discussions.unity.com/u/OzzyHont)
#### Post date: [March 18, 2017, 4:52am UTC](https://discussions.unity.com/t/shader-setglobalvariable-vs-commandbuffer-setglobalvariable/658666/1 "2017-03-18T04:52:41Z")

</div>

i can`t find distinguish…  
is same?

---

<div class="post-metadata">

### Author: ![colin299](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/colin299/32/178215_2.png) [@colin299](https://discussions.unity.com/u/colin299)
#### Post date: [March 18, 2017, 8:42pm UTC](https://discussions.unity.com/t/shader-setglobalvariable-vs-commandbuffer-setglobalvariable/658666/2 "2017-03-18T20:42:40Z")

</div>

CommandBuffer.SetGlobalVariable will not be triggered immediately, it is only useful when you are creating you own command buffer(for inserting render commands to a camera event). While Shader.SetGlobalVariable is the regular API if you want to set a global variable immediately though code.
