Hi,
Is there any way to relay the object which hotspot has been "Use:"d and use this to modify that object?
As an example, if I have 30 buttons (each with a hotspot) that will change color when pressed, instead of making 30 action lists, is there any way to make one action list that would change the color of the object which hotspot was just clicked? This action would then go in all Use: fields of all 30 buttons. In this example the "Change Material, renderer" would be "Render of object which hotspot was clicked". Same could be used for e.g. Object:transforms where Moveable Object would also be "Object which hotspot was clicked" etc.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Yes - ActionList parameters can be used to "recycle" Actions by altering their field values at runtime.
In your example, a GameObject parameter named "Render object" could be defined, and then used to override the renderer field on the Object: Change material Action.
A tutorial on parameters can be found here.
Parameter values can be set in a number of ways, but to do so as part of a Hotspot interaction, use the "Set Interaction Parameters" component. Attach this to your Hotspot, and you can then set values for all parameters your Use interaction has defined.
A more advanced tutorial that uses this technique to prefab puzzle logic can be found here.
Yes!! Thank you for this. Worked great. First time to use the Set Interaction Parameters component!
Sorry, one more thing in relation to the above. To continue the above example, when resetting the 30 buttons' material/transform/component variable, is there any way to do this in AC without a foreach-type custom script? All buttons are child objects of the same parent. I currently have a component variable IsPressed on each button to avoid pressing it twice, and a "Reset all buttons"-button. With my limited C# knowledge and how to link a custom script to the action list, the method I'm using now is a 30-step action list to reset each material/transform/comp variable etc.
No - a script would be best in this case.
I can assist, however. To bulk-assign "IsPressed" bool variables to False, you can use this script:
To run it, add to the scene and use the Object: Call event or Object: Send message Action to trigger the component's Reset function.
Thanks a lot for this. It works fine! I might have got a bit ahead of myself in trying to do more than my skills allow, and this may be more of a C#/unity question but any pointer would be great. The below is to reset Bool "IsIn" to false, and reset position of z for all child objects. I will also add material etc. to this as needed.
To use the above script in various situations, I tried the following
https://imgur.com/a/zWZAMXB
This can be safely ignored.
Unity's base Transform component doesn't feature its own "move over time" functions - if you use that, you need to have your script run a coroutine to update them each frame.
AC's ActionTransform script relies on AC's Moveable component, which does provide these functions. If you attach a Moveable, you can use it to handle this for you by replacing:
with:
Replacing "5" with the intended duration.
Thanks again!! On a Sunday!!
It seemed the Move() with 5 arguments needs a Marker in the first slot. I didn't know how to convert the Vector3 childPosition to a Marker so I tried the Move() with 8 arguments
And it works!! Thanks!! The Scripting guide pages are slowly becoming understandable for me!