Arcadia icon indicating copy to clipboard operation
Arcadia copied to clipboard

.SetFloat using a def'd int leads to invalid IL

Open saikyun opened this issue 7 years ago • 2 comments

When running

(def saturation-id (Shader/PropertyToID "_Saturation"))
(.SetFloat mat saturation-id target)

where mat is a UnityEngine.Material, I get

InvalidProgramException: Invalid IL code in game$reactive$refresh_stamina_ui__20172:invokeStatic (object,object,object): IL_01cb: call      0x06fff620


game$reactive$refresh_stamina_ui__20172.invoke (System.Object , System.Object , System.Object ) (at <91f979e122e34249bc0a7928b0770bc1>:0)
game$reactive$cards_watcher_update__20209.invokeStatic (System.Object , System.Object ) (at <91f979e122e34249bc0a7928b0770bc1>:0)
game$reactive$cards_watcher_update__20209.invoke (System.Object , System.Object ) (at <91f979e122e34249bc0a7928b0770bc1>:0)
ArcadiaBehaviour.RunFunctions () (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:499)
UpdateHook.Update () (at Assets/Arcadia/Components/UpdateHook.cs:9)

If I put 565 (the value of saturation-id) directly into the call of .SetFloat I don't get the error.

saikyun avatar Feb 09 '19 10:02 saikyun

I can't seem to reproduce. Can you provide a more complete self-contained failing case? The following seems to work for me

(use 'arcadia.core)
(import [UnityEngine Shader Material MeshRenderer])

(def cube (create-primitive :cube))

(def saturation-id (Shader/PropertyToID "_Saturation"))
(def target 5.5)

(let [mat (.material (cmpt cube MeshRenderer))]
  (.SetFloat mat saturation-id target))

nasser avatar Feb 15 '19 23:02 nasser

Sorry for not replying. I'll try to provide a better example, the issue is that sometimes it seems to work. There's something weird going on. I'll get back to you.

saikyun avatar Mar 04 '19 12:03 saikyun