Added libpd2Unity readme.
This commit is contained in:
parent
19d40ab8eb
commit
a99a387e52
4 changed files with 60 additions and 1 deletions
|
|
@ -76,6 +76,7 @@
|
|||
<None Include="Assets\02-A note on PD patches.txt" />
|
||||
<None Include="Assets\01-Readme First.txt" />
|
||||
<None Include="Assets\04-Readme Unity2LibPdScene.txt" />
|
||||
<None Include="Assets\05-Readme LibPd2UnityScene.txt" />
|
||||
<Reference Include="UnityEngine.Purchasing">
|
||||
<HintPath>C:/Users/Niall Moody/Programming/Unity/LibPdIntegrationExamples/Library/ScriptAssemblies/UnityEngine.Purchasing.dll</HintPath>
|
||||
</Reference>
|
||||
|
|
|
|||
51
Assets/05-Readme LibPd2UnityScene.txt
Normal file
51
Assets/05-Readme LibPd2UnityScene.txt
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
Unity2LibPdScene Notes
|
||||
----------------------
|
||||
This scene demonstrates how to communicate from libpd to Unity.
|
||||
|
||||
In our PD patch this is relatively simple: we just create a send object to send
|
||||
data to Unity.
|
||||
|
||||
|
||||
On the Unity end, however, things are a bit more complicated. The required steps
|
||||
are:
|
||||
|
||||
1.) Bind() to the desired send object. libpd will not make send signals
|
||||
available to Unity by default. We need to tell it we are interested in
|
||||
specific signals. We do this using the Bind() function in LibPdInstance,
|
||||
e.g. pdPatch.Bind("BangTest"); (if BangTest is the name of our send object).
|
||||
|
||||
2.) Write a function that will be called whenever that send object sends a
|
||||
signal to us. The signature of that function will have to match the
|
||||
signature LibPdInstance is expecting. For instance, a function that reacts
|
||||
to bang signals would look like this:
|
||||
|
||||
public void BangReceive(string name)
|
||||
|
||||
And a function that reacts to float (or number) signals would look like
|
||||
this:
|
||||
|
||||
public void FloatReceive(string name, float value)
|
||||
|
||||
Where name is the name of the send object, and value is the float value that
|
||||
was sent from your PD patch.
|
||||
|
||||
You can see a full list of function signatures on the wiki:
|
||||
https://github.com/LibPdIntegration/LibPdIntegration/wiki/libpd2unity#unityevents
|
||||
|
||||
3.) Connect your LibPdInstance Component to the above function. LibPdInstance
|
||||
uses Unity events for this. If you expand the Pure Data Events header you
|
||||
will see a list of 5 UnityEvent widgets, one for each of the signal types
|
||||
which can be sent from your PD patch.
|
||||
|
||||
To connect to your function, you need to click the + button for your
|
||||
desired signal type, then drag the GameObject containing your receive
|
||||
script into the 'None (object)' box.
|
||||
|
||||
Then, if you click the drop-down that says 'No Function', you will get a
|
||||
list of possible destinations. Select your receiving script/Component, and
|
||||
then, under the Dynamic header, select the receive function you created in
|
||||
the previous step.
|
||||
|
||||
Note: You will see 2 copies of your function in that final menu: one under
|
||||
'Dynamic', one under 'Static'. It is important that you select the entry
|
||||
under 'Dynamic'; the one under 'Static' will not work for our purposes.
|
||||
7
Assets/05-Readme LibPd2UnityScene.txt.meta
Normal file
7
Assets/05-Readme LibPd2UnityScene.txt.meta
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1d793fff838094a4692ae7004fd58b38
|
||||
TextScriptImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -328,7 +328,7 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: 14496bc842cc2dd40b3da723e07b976d, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
patchName: FloatExample
|
||||
patchName: SineEnvelope
|
||||
patchDir: /PdAssets/LibPd2UnityPatches/
|
||||
patch: {fileID: 102900000, guid: 9ab0089af2eeb0c419b1315779d38b33, type: 3}
|
||||
pipePrintToConsole: 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue