Skip to content

Commit b4e77a5

Browse files
committed
add _GetGlobalState to Udon controller
1 parent 1bd7212 commit b4e77a5

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

Runtime/LTCGI_UdonAdapter.asset

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ MonoBehaviour:
4444
Data:
4545
- Name:
4646
Entry: 12
47-
Data: 37
47+
Data: 38
4848
- Name:
4949
Entry: 7
5050
Data:
@@ -1914,6 +1914,54 @@ MonoBehaviour:
19141914
- Name:
19151915
Entry: 8
19161916
Data:
1917+
- Name:
1918+
Entry: 7
1919+
Data:
1920+
- Name: $k
1921+
Entry: 1
1922+
Data: _globalState
1923+
- Name: $v
1924+
Entry: 7
1925+
Data: 91|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
1926+
- Name: <Name>k__BackingField
1927+
Entry: 1
1928+
Data: _globalState
1929+
- Name: <UserType>k__BackingField
1930+
Entry: 9
1931+
Data: 3
1932+
- Name: <SystemType>k__BackingField
1933+
Entry: 9
1934+
Data: 3
1935+
- Name: <SyncMode>k__BackingField
1936+
Entry: 7
1937+
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
1938+
- Name:
1939+
Entry: 6
1940+
Data:
1941+
- Name:
1942+
Entry: 8
1943+
Data:
1944+
- Name: <IsSerialized>k__BackingField
1945+
Entry: 5
1946+
Data: false
1947+
- Name: _fieldAttributes
1948+
Entry: 7
1949+
Data: 92|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
1950+
- Name:
1951+
Entry: 12
1952+
Data: 0
1953+
- Name:
1954+
Entry: 13
1955+
Data:
1956+
- Name:
1957+
Entry: 8
1958+
Data:
1959+
- Name:
1960+
Entry: 8
1961+
Data:
1962+
- Name:
1963+
Entry: 8
1964+
Data:
19171965
- Name:
19181966
Entry: 13
19191967
Data:

Runtime/LTCGI_UdonAdapter.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void _Initialize()
134134
GlobalShader.SetGlobalInt(GlobalShader.PropertyToID("_Udon_LTCGI_ScreenCount"), _LTCGI_ScreenCountMaskedAvatars);
135135
#endif
136136

137-
GlobalShader.SetGlobalFloat(GlobalShader.PropertyToID("_Udon_LTCGI_GlobalEnable"), 1.0f);
137+
_SetGlobalState(true);
138138

139139
if (_LTCGI_static_uniforms != null)
140140
GlobalShader.SetGlobalTexture(GlobalShader.PropertyToID("_Udon_LTCGI_static_uniforms"), _LTCGI_static_uniforms);
@@ -283,12 +283,14 @@ public void _SetTexture(int screen, uint index)
283283
if (!this.enabled) Update();
284284
}
285285

286+
private bool _globalState = false;
286287
public void _SetGlobalState(bool enabled)
287288
{
288289
float fstate = enabled ? 1.0f : 0.0f;
289290
GlobalShader.SetGlobalFloat(GlobalShader.PropertyToID("_Udon_LTCGI_GlobalEnable"), fstate);
291+
_globalState = enabled;
290292
}
291-
293+
public bool _GetGlobalState() => _globalState;
292294

293295
// Below code from: https://github.com/Xytabich/UNet
294296

0 commit comments

Comments
 (0)