I've been through the tutorials on a creating a custom ActionList, but I'm unable to create a script that successfully changes a skybox's material. Has anyone managed this?
Close. You've declared "newSkybox" as a GameObject, whereas it should be a Material. You'll have to update this definition in ShowGUI(), too.
Finally, in Run() you're not checking for the Skybox component in obToAffect. But you could instead declare obToAffect as a Skybox, so that it's not necessary.
I need to change the Skybox material in an Action Script as this older topic does, but I have tried the linked code and found I cant get it to work. The Custom Action of Change Skybox appears in the Unity editor, and I have attached the added script above and attached to the MainCamera, but nothing happens.
What might I be doing wrong? Perhaps Unity has updated to the point this code no longer works, I am using Unity 5.6. I half remember Skybox's materials used to be set on Camera but are now in the Lighting Tab - Could that be part of my issue?
Comments
Finally, in Run() you're not checking for the Skybox component in obToAffect. But you could instead declare obToAffect as a Skybox, so that it's not necessary.
I need to change the Skybox material in an Action Script as this older topic does, but I have tried the linked code and found I cant get it to work. The Custom Action of Change Skybox appears in the Unity editor, and I have attached the added script above and attached to the MainCamera, but nothing happens.
What might I be doing wrong? Perhaps Unity has updated to the point this code no longer works, I am using Unity 5.6. I half remember Skybox's materials used to be set on Camera but are now in the Lighting Tab - Could that be part of my issue?
Thanks
I'd say so. This thread seems to show the new way to change a skybox at runtime.
This new way should do without the need for any script on the MainCamera - just a custom Action. For a tutorial on writing custom Actions, see here.