0
Planowane

Version Control Integration

Brian Hall 11 lat temu Ostatnio zmodyfikowane przez Freya Holmér (Developer) 9 lat temu 35
I currently use P4 integration built into Unity and the version control doesn't work when editing shaders.  I have to manually check out the file for shader forge to be able to edit it.  It would be good to have version control support.

Odpowiedź

Odpowiedź
Planowane
This is potentially fixed in 0.18 now, let me know if it works when it's out :)
Interesting, I haven't even thought of that. What happens when you try opening shaders?
Opening a checked in shader results in:
UnauthorizedAccessException: Access to the path "<path>\HeroCharacter.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
Ouch. Hm. I've never used an integrated Perforce in Unity before. Do you know of any links on how to deal with file access in Unity when using Perforce?
Awesome, thanks for the help finding it :)
I'll see if I can get this into 0.18, as it's quite a critical bug!
Odpowiedź
Planowane
This is potentially fixed in 0.18 now, let me know if it works when it's out :)
Hello Brian!
Shader Forge 0.18 is out now, so this issue might have been fixed. Could you have a look? :)
Sorry, no luck.  I opened a shader, then closed the shaderforge window and got this in the output pane.

UnauthorizedAccessException: Access to the path "<shaderpath>\Ghost.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
And you did a clean reinstall? Removed old SF and installed the new?
Yes sir.  Deleted the entire shaderforge folder and re-added from unitypackage.
What is usually involved in the process of changing a locked file?
Unlock and checkout?
In 0.18 I simply did checkout, but I didn't add Lock(asset, false). So I might need to first unlock, and then checkout?
You should not need to Lock an asset.  Locking is for exclusive editing.
Strange. Not sure what could be wrong then. I'll have to do some more research
Hope this gets fixed soon! 
Brian - could you try it again with 0.19?
Still not working as of Version 0.20:
STR:
1. Select Shader in Project
2. Click Open in Shader Forge
3. Move a node around.
4. Click "Compile Shader" button
5. Close ShaderForge editor.
6. Observe error in console.
7. Profit.

UnauthorizedAccessException: Access to the path "<myshaderpath>\Ghost.shader" is denied.
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/FileStream.cs:320)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.IO/StreamWriter.cs:124)
System.IO.StreamWriter..ctor (System.String path)
(wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string)
ShaderForge.SF_Evaluator.SaveShaderAsset ()
ShaderForge.SF_Evaluator.Evaluate ()
ShaderForge.SF_Editor.OnDisable ()
UnityEditor.DockArea:OnGUI()
How is your Unity version control system set up?
Could you write a step-by-step on how I would set it up and replicate it?
Surely!

1. Hit Ctrl-0 to bring up the version control window.
2. Click the settings button in the upper right to get at the settings panel.
3. Under Mode select "Perforce"
4. Enter your p4 username 
5. Enter your p4 password
6. Enter your p4 workspace for your project
7. Enter your p4 server:port
8. Log Level to Info
9. Check Automatic Add
10. Do not check Work Offline
11. Asset Serialization "Force Text"
12. Default Behavior Mode 3D
13. Sprite Packer Enabled for Builds.
14. Click Connect button mid upper right.

Enjoy Perforce!
I can't open the version control. I presume it's because I'm missing the team license?
Yes, Team License required.  Perhaps Unity can extend one to you?  Otherwise I think a trial Pro license will give it to you.
I think I've already used that one : <
Drop me an email (bhall@turbine.com).
Issue remains in current version 0.22.
Issue remains in current version 0.27.
BTW-

UnityEditor.VersionControl.Provider.Checkout( PathToAsset(), UnityEditor.VersionControl.CheckoutMode.Both ).Wait();

This works for me for my Editor stuff.
Interesting. I've done pretty much the same, but I haven't done the .Wait() part. Do I have to do it in a coroutine then, or does it work in both cases?
When I call it, its just in a straight if statement off a GUI.Button() call.  Works there.
Cool, I'll try this tomorrow :) Thanks for the help
I notice I have to manually check stuff out, is it supposed to be checking stuff out?

(FWIW. I use the UnityEditor.VersionControl API in my own utils )

FWIW I just got bitten by this yet, again. Please call UnityEditor.VersionControl,Checkout() before compiling. Please! Pretty Please!

I can have a look at this again for the next update